日期:2014-05-16  浏览次数:20701 次

linux下安装nginx

1.下载

nginx

http://nginx.org/download/nginx-1.0.4.tar.gz

Perl Compatible Regular Expressions(用来rewrite,否则会提示error: the HTTP rewrite module requires the PCRE library.)

?

ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.12.tar.gz


?

?

2.解压缩

tar -zxvf pcre-8.12.tar.gz

tar -zxvf nginx-1.0.4.tar.gz

?

3.进入pcre-8.12目录后

./configure ? ?

make

make install

?

4.进入nginx-1.0.4目录后

运行

./configure --prefix=/usr/local/nginx --with-http_stub_status_module

make

make install

?

搞定...

?

启动nginx

?/usr/local/nginx/sbin/nginx

停止nginx

killall -QUIT nginx

重启nginx

killall -HUP nginx


测试配置文件
/usr/local/nginx/sbin/nginx -t
可看到如下输出
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful