环境:centos 7 x64
安装包下载地址:https://pan.baidu.com/s/1Vg6yySVmlt4N2dbuOClcNQ
提取码:ozbm
#!/bin/bash
#nginx自动化安装脚本,将下载的文件放在/opt/文件下
yum -y install gcc* zlib zlib-devel pcre pcre-devel openssl openssl-devel
useradd -s /sbin/nologin nginx
cd /opt
tar -zxvf nginx-1.16.0.tar.gz
cd nginx-1.16.0
./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_sub_module --with-http_ssl_module --with-pcre
make && make install
ln -s /usr/local/nginx/sbin/nginx /usr/bin/
nginx -t #检测nginx是否有语法错误
nginx
查看端口 80
[root@localhost ~]$netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address
tcp 0 0 0.0.0.0:80 0.0.0.0:*
tcp 0 0 0.0.0.0:22 0.0.0.0:*
tcp 0 0 127.0.0.1:25 0.0.0.0:*
tcp6 0 0 :::22 :::*
tcp6 0 0 ::1:25 :::*