编译安装nginx

1、编译安装nginx之前需要安装相应的依赖库

yum -y install gcc gcc-c++ autoconf automake
yum -y install zlib zlib-devel openssl openssl-devel

 安装pcre-8.36

在https://sourceforge.net/projects/pcre/files/pcre/8.36/下载pcre-8.36

tar -zxvf pcre-8.36.tar.gz
cd pcre-8.36
/.configure
make && make install

 2、安装nginx

在nginx官方网站上下载最新的nginx,我这里用的是nginx-1.13.5

tar -zxvf nginx-1.13.5.tar.gz
cd nginx-1.13.5
./configure  --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.36
make && make install

 3、配置nginx

nginx的配置文件默认的路径为 /usr/local/nginx/conf/nginx.conf 可以根据自己的需要进行修改

4、nginx的操作

1)启动

/usr/local/nginx/sbin/nginx/nginx

 2)重读

/usr/local/nginx/sbin/nginx -s reload

 3)停止

/usr/local/nginx/sbin/nginx -s stop

 

posted @ 2017-09-22 16:01  yqyqy  阅读(143)  评论(0)    收藏  举报