centOs7.5 install nginx
###centOs7.5 安装 nginx
#安装依赖
yum -y install gcc-c++ pcre pcre-devel zlib zlib-devel
yum -y install openssl openssl-devel wget
#下载编译安装
wget -c http://nginx.org/download/nginx-1.12.2.tar.gz
tar -zxvf nginx-1.12.2.tar.gz
cd nginx-1.12.2
./configure –prefix=/usr/local/nginx –with-http_stub_status_module –with-http_ssl_module –with-stream
make && make install
whereis nginx
cd ..
rm -rf nginx-1.12.2
rm -rf nginx-1.12.2.tar.gz
useradd -s /sbin/nologin -M nginx
chown -R nginx.nginx /usr/local/nginx
#配置服务文件
echo “
[Unit]
Description=nginx
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
“ >> /etc/systemd/system/nginx.service
#启动服务
systemctl daemon-reload
systemctl enable nginx
systemctl is-enabled nginx
#systemctl disable nginx
systemctl status nginx
systemctl start nginx
systemctl status nginx
#systemctl restart nginx
netstat -lntp
原文作者: IT梅
原文链接: http://www.meixiaohan.com/2018/12/16/centOs7.5安装nginx/
版权声明: 转载请注明出处(必须保留原文作者署名原文链接)