码迷,mamicode.com
首页 > 系统相关 > 详细

linux nginx管理

时间:2019-10-23 18:26:36      阅读:89      评论:0      收藏:0      [点我收藏+]

标签:ash   success   list   class   chart   状态   multi   oca   char   

1、添加 Nginx 服务

vim /lib/systemd/system/nginx.service

添加如下内容:

[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
PrivateTmp=true
Restart=on-failure
RestartSec=20s
[Install]
WantedBy=multi-user.target


启动 Nginx 设置开机启动

    启动: systemctl start nginx

    查看状态:systemctl status nginx

    设置为系统默认启动: systemctl enable nginx

 

 

 

 

2、查看当前nginx进程启用的配置文件

[root@VM_58_118_centos system]# netstat -anop | grep 0.0.0.0:80
tcp        0      0 0.0.0.0:8009            0.0.0.0:*               LISTEN      7107/java            off (0.00/0/0)
tcp        0      0 0.0.0.0:8079            0.0.0.0:*               LISTEN      7107/java            off (0.00/0/0)
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      1695/httpd           off (0.00/0/0)
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      17785/nginx: master  keepalive (0.07/0/0)
[root@VM_58_118_centos system]# ll  /proc/17785/exe
lrwxrwxrwx 1 root root 0 10月 20 23:59 /proc/17785/exe -> /usr/sbin/nginx
[root@VM_58_118_centos system]# /usr/sbin/nginx -t
nginx: [warn] conflicting server name "chart.syhuo.net" on 0.0.0.0:80, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@VM_58_118_centos system]#

 

linux nginx管理

标签:ash   success   list   class   chart   状态   multi   oca   char   

原文地址:https://www.cnblogs.com/hnhycnlc888/p/11727711.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!