编译安装的Nginx程序(Nginx-1.13.6)
1.配置编译环境
yum install gcc gcc-c++ automake pcre pcre-devel zlip zlib-devel openssl openssl-devel wget unzip
1.下载安装包
wget http://nginx.org/download/nginx-1.13.6.tar.gz
3.解压配置编译安装
#解压tar zxvf nginx-1.13.6.tar.gz#进入nginx目录cd nginx-1.13.6#配置选项./configure \--prefix=/usr/local/nginx \--sbin-path=/usr/local/nginx/sbin/nginx \--conf-path=/usr/local/nginx/conf/nginx.conf \--error-log-path=/var/log/nginx/error.log \--http-log-path=/var/log/nginx/access.log \--pid-path=/var/run/nginx.pid \--lock-path=/var/lock/nginx.lock \--user=nginx \--group=nginx \--with-http_ssl_module \--with-http_v2_module \--with-http_stub_status_module \--with-http_gzip_static_module \--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/ \--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \--http-scgi-temp-path=/var/tmp/nginx/scgi \--with-pcre#编译/安装make && make install
4.安装完成后的设置
#进入/etc/init.d/cd /etc/init.d/#制作软连接ln -s /usr/local/nginx/sbin/nginx#创建nginx用户useradd -s /sbin/nologin -M nginx#创建临时文件夹mkdir -p /var/tmp/nginx/
5.启动
/etc/init.d/nginx
启动后可以输入命令netstat -lntp查看80端口
[root@VM_150_196_centos ~]# netstat -lntpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 32108/nginx: master tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 9977/sshd tcp6 0 0 :::22 :::* LISTEN 9977/sshd
加入开机启动
vim /etc/rc.local
在最后加上/etc/init.d/nginx
扩展延伸
参考:Nginx 之一:编译安装nginx 1.8.1 及配置
网页标题:编译安装的Nginx程序(Nginx-1.13.6)
文章分享:http://pwwzsj.com/article/godj.html