首页 > 其他 > 详细

Nginx脚本安装

时间:2020-09-13 17:25:23      阅读:76      评论:0      收藏:0      [点我收藏+]

cat > nginx.sh <<EOF

#停止apache,避免抢占端口号

systemctl stop httpd

#创建nginx运行账户,非登录用户,不创建家目录

useradd -M -s /sbin/nologin nginx

#安装依赖包

yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel gcc gcc-c
++ make cmake

#解压nginx源码包

tar xf nginx-1.10.3.tar.gz

#进入到解压后的包

cd nginx-1.10.3

#指定安装目录,和模块

./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stu
b_status_module --with-http_ssl_module #指定安装目录,和模块

make && make install

#启动

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

#写入开机启动

echo "/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf" >> /etc/r
c.local

#查看运行端口,确定安装成功

netstat -tanp|grep 80

EOF

需要提前准备nginx源码包在脚本执行目录下!

Nginx脚本安装

原文:https://www.cnblogs.com/haojinfei/p/13661738.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!