首页 > 其他 > 详细

CentOS7.8源码安装nginx

时间:2021-03-13 16:52:52      阅读:33      评论:0      收藏:0      [点我收藏+]

nginX:下载地址

 nginx反向代理访问:rethinkdb

编译安装即可

修改配置:vi /usr/local/nginx1.19/conf/nginx.conf

 

环境配置:vi /etc/profile

#nginx Env
export NGINX_HOME=/usr/local/nginx1.19
export PATH=${NGINX_HOME}/sbin:$PATH

检查配置:nginx -V

启动:./nginx
重载:./nginx -s reload
停止:./nginx -s stop

 

配置系统服务

进入目录 /usr/lib/systemd/system,新建文件 nginx.service,添加如下内容

[Unit]
Description=nginx
After=network.target remote-fs.target nss-lookup.target

#下边的路径换成本地实际的即可
[Service]
ExecStart=/usr/local/nginx1.19/sbin/nginx -c /usr/local/nginx1.19/conf/nginx.conf
ExecReload=/usr/local/nginx1.19/sbin/nginx -s reload -c /usr/local/nginx1.19/conf/nginx.conf
ExecStop=/usr/local/nginx1.19/sbin/nginx -s quit
PrivateTmp=true
 
[Install]
WantedBy=multi-user.target
查看状态:systemctl status nginx
启动服务:systemctl start nginx
停止服务:systemctl stop nginx
重载服务:systemctl reload nginx
启用开机启动:systemctl enable nginx
关闭开机启动:systemctl disable ngixn

 

CentOS7.8源码安装nginx

原文:https://www.cnblogs.com/sc912/p/14528878.html

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