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 沒問題







 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM