关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回新闻公共列表

最新版:linux下Nginx 0.8.40的安装方法

发布时间:2023-04-04 13:55:06
1491984010112764.jpg

Nginx作为一个后起之秀,他的迷人之处已经让很多人都投入了他的怀抱。配置简单,实现原理简单。做一个负载平衡的再好不过了。

一、依赖的程序

1. gzip module requires zlib library
2. rewrite module requires pcre library
3. ssl support requires openssl library

二、依赖的程序的安装的方法有两种:一种是比较原始的方法一个一个来安装,另一个是最好的方法用YUM一次性安装

(1)、方法一如下:这下方法原始、麻烦、容易出错。不过安装的过程可以熟悉一下Linux 命令,呵呵。

1、zlib 现在最新的版本是zlib-1.2.5
官网下载地址:http://www.zlib.net/zlib-1.2.5.tar.gz
$tar -xvzf zlib-1.2.5.tar.gz
$cd zlib-1.2.5.tar.gz
$./configure
$make
$make install
2、 pcre现在的最新版本是pcre-8.02.tar.gz
官网下载地址:ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre- 8.02.tar.gz
$tar -xvzf pcre-8.02.tar.gz
$cd pcre-8.02
$./configure --prefix=/usr/local/pcre --enable-utf8 --enable-unicode-properties
$ make && make install
3、openssl现在最新版本是openssl-1.0.0a.tar.gz
官网下载地址:http://openssl.org/source/openssl-1.0.0a.tar.gz
$tar zvxf openssl-1.0.0.tar.gz
$cd openssl-1.0.0
$./config --prefix=/usr/local/ssl-1.0.0 shared zlib-dynamic enable-camellia
$make && make install
4、安装Nginx 0.8.40,这种方法./configure 要带很多参数。大家要注意。
Nginx 最新的版本是Nginx 0.8.40
官网下载地址:http://www.nginx.org/
$tar zvxf Nginx 0.8.40.tar.gz
$cd Nginx 0.8.40
$./configure
$ make
$ make install
默认安装的路径是/usr/local/nginx

更多的安装配置
./configure --prefix=/usr/local/nginx
--with-openssl=/usr/include (启用ssl)
--with-pcre=/usr/include/pcre/ (启用正规表达式)
--with-http_stub_status_module (安装可以查看nginx状态的程序)
--with-http_memcached_module (启用memcache缓存)
--with-http_rewrite_module (启用支持url重写)

(2)、方法二如下:这种方法就好,不容易出错,如果网速快10分内可以完成,网速不好也可以在20分内完成。

yum –y install zlib zlib-devel openssl openssl-devel pcre pcre-devel

现在三个依赖的程序的安装成功,下面是安装Nginx 0.8.40了。

官网下载地址:http://www.nginx.org/
$tar zvxf Nginx 0.8.40.tar.gz
$cd Nginx 0.8.40
$./configure //默认安装在/usr/local/nginx下
$ make
$ make install

四、启动及重启

1、启动:
$ cd /usr/local/nginx/sbin
$ ./nginx
打开浏览器在地址栏输入127.0.0.1然后会出现一句话 welcome to nginx
2、重启:kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
3、测试配置文件:./nginx -t



/template/Home/8a/PC/Static