Nginx 碰到的问题

  • 这是第一个问题

1.问题过程

ab 测试的时候出现的问题

Benchmarking 39.105.12.8 (be patient)...apr_socket_recv: Connection refused (111)

然后

[root@smoker-linux conf.d]# systemctl reload nginx.service
Job for nginx.service invalid.

解决方法:

[root@smoker-linux conf.d]# sudo systemctl enable nginx.service
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
[root@smoker-linux conf.d]# sudo systemctl start nginx.service
[root@smoker-linux conf.d]# systemctl status nginx.service
-----------------------------------------------------------------------------------------------------

● nginx.service - nginx - high performance web server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2018-07-16 11:45:23 CST; 16s ago
     Docs: http://nginx.org/en/docs/
  Process: 2146 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
 Main PID: 2147 (nginx)
   CGroup: /system.slice/nginx.service
           ├─2147 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
           └─2148 nginx: worker process

Jul 16 11:45:23 smoker-linux systemd[1]: Starting nginx - high performance web server...
Jul 16 11:45:23 smoker-linux systemd[1]: Failed to read PID from file /var/run/nginx.pid: Invalid argument
Jul 16 11:45:23 smoker-linux systemd[1]: Started nginx - high performance web server.
-----------------------------------------------------------------------------------------------------
看上边信息Nginx算是启动了 但是有个Failed,尝试访问服务也没问题,不过还是的解决这个Failed
网上查资料 又是一顿操作:
[root@smoker-linux conf.d]# mkdir -p /etc/systemd/system/nginx.service.d
[root@smoker-linux conf.d]# printf "[Service]\nExecStartPost=/bin/sleep 0.1\n" > /etc/systemd/system/nginx.service.d/override.conf
[root@smoker-linux conf.d]# systemctl daemon-reload
[root@smoker-linux conf.d]# systemctl restart nginx.service
[root@smoker-linux conf.d]#  systemctl status nginx.service
-----------------------------------------------------------------------------------------------------

● nginx.service - nginx - high performance web server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/nginx.service.d
           └─override.conf
   Active: active (running) since Mon 2018-07-16 11:56:57 CST; 8s ago
     Docs: http://nginx.org/en/docs/
  Process: 2186 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS)
  Process: 2191 ExecStartPost=/bin/sleep 0.1 (code=exited, status=0/SUCCESS)
  Process: 2189 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
 Main PID: 2190 (nginx)
   CGroup: /system.slice/nginx.service
           ├─2190 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
           └─2192 nginx: worker process

Jul 16 11:56:57 smoker-linux systemd[1]: Starting nginx - high performance web server...
Jul 16 11:56:57 smoker-linux systemd[1]: Started nginx - high performance web server.
-----------------------------------------------------------------------------------------------------
如上查看 是没有什么问题,查看Nginx PID
[root@smoker-linux conf.d]# ps -ef|grep nginx
root      2210     1  0 11:57 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx     2212  2210  0 11:57 ?        00:00:00 nginx: worker process
root      2237  2043  0 12:02 pts/0    00:00:00 grep --color=auto nginx

在使用ab进行测试 OK 没问题







 

posted @ 2018-07-16 12:07 smokerBig 阅读(...) 评论(...) 编辑 收藏