码迷,mamicode.com
首页 > 其他好文 > 详细

编译安装Nginx

时间:2017-07-28 23:59:53      阅读:346      评论:0      收藏:0      [点我收藏+]

标签:log   roc   proc   关闭进程   hup   size   configure   prefix   org   

 

############## 安装OpenSSL ######################
wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz
tar zxvf openssl-1.0.2l.tar.gz
cd openssl-1.0.2l/
./config --prefix=/opt/local/openssl ;
make && sudo make install

################ 安装PCRE ########################
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
tar zxvf pcre-8.41.tar.gz
./configure --prefix=/opt/local/pcre-8.41 ;
make && sudo make install

################ 安装Nginx ########################
# 配置nginx (--with-pcre、--with-openssl 的路径是源码路径)
./configure --prefix=/opt/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-pcre=../pcre-8.41 --with-openssl=../openssl-1.0.21

# 1.查看帮助
$ /opt/local/nginx/sbin/nginx -h
# 2.检查配置文件正确性
$ sudo /opt/local/nginx/sbin/nginx -t

# 3.查看进程号
$ cat /opt/local/nginx/logs/nginx.pid
23214
$ ps -ef | grep "nginx: master process" | grep -v ‘grep‘ | awk -F ‘ ‘ ‘{print $2}‘
23214
# 4.重新加载配置
sudo kill -HUP `cat /opt/local/nginx/logs/nginx.pid`

# 5.赋予普通用户操作权限
sudo chmod u+s /opt/local/nginx/sbin/nginx
# 6.停止nginx
/opt/local/nginx/sbin/nginx -s stop
# 处理完请求后,关闭进程
$ kill -QUIT ` cat /opt/local/nginx/logs/nginx.pid `

编译安装Nginx

标签:log   roc   proc   关闭进程   hup   size   configure   prefix   org   

原文地址:http://www.cnblogs.com/cpuz/p/7252878.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!