centos 手动安装nginx
下载 :http://nginx.org/en/download.html
解压源码,进入nginx的目录运行:
1. 默认安装
./configure
make
make install
默认的安装目录:/usr/local/nginx
2. 定制安装
安装nginx之前,先安装依赖包
yum install openssl-devel pcre-devel zlib-devel
./configure
--prefix=/usr \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/tmp/nginx/client/ \
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/
编译安装:
make && make install
启动:/usr/sbin/nginx
配置文件在: /etc/nginx/nginx.conf
3. 一些运行命令
启动:nginx
重启:kill -HUP `cat /var/run/nginx/nginx.pid`
#重新加载配置,并开启新的工作进程,关闭就的进程,此操作不会中断请求.
杀死:kill -TERM `cat /var/run/nginx/nginx.pid`
#快速关闭程序,中止当前正在处理的请求 .
关闭 : kill -QUIT `cat /var/run/nginx/nginx.pid`
#处理完当前请求后,关闭程序 .
nginx -t 测试配置文件是否正确. 在运行时需要重新加载配置的时候,此命令非常重要,用来检测所修改的配置文件是否有语法错误.

浙公网安备 33010602011771号