2017-03-02 7 views
1

nginx를 설치 한 후 nginx 시작 페이지에 액세스 할 수 있습니다.centos 7 : nginx /run/nginx.pid 파일에서 PID를 읽지 못했습니다. 잘못된 인수

systemd [1] : 파일 /run/nginx.pid에서 PID를 읽지 못했습니다 : 잘못된 인수하는

당신이 말해 주시겠습니까 내가 systemctl status nginx을 실행할 때, 나는이 경고를 이 문제의 원인과 해결 방법은 무엇입니까? 감사.

자세한 응답 메시지 :

 
nginx.service - The nginx HTTP and reverse proxy server  
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)  
Active: active (running) since Thu 2017-03-02 06:43:24 CST; 2s ago 
Process: 24007 ExecReload=/bin/kill -s HUP $MAINPID (code=exited, status=0/SUCCESS) 
Process: 8377 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS) 
Process: 8374 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS) 
Process: 8373 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS) 
Main PID: 8380 (nginx) CGroup: /system.slice/nginx.service 
      |-8380 nginx: master process /usr/sbin/ngin 
      `-8381 nginx: worker proces 

Mar 02 06:43:24 VM_134_114_centos systemd[1]: Starting The nginx HTTP and reverse proxy server... 
Mar 02 06:43:24 VM_134_114_centos nginx[8374]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 
Mar 02 06:43:24 VM_134_114_centos nginx[8374]: nginx: configuration file /etc/nginx/nginx.conf test is successful 
Mar 02 06:43:24 VM_134_114_centos systemd[1]: Failed to read PID from file /run/nginx.pid: Invalid argument 
Mar 02 06:43:24 VM_134_114_centos systemd[1]: Started The nginx HTTP and reverse proxy server. 

답변

2

당신이 그것을 해결 할 수 있다고 생각하지 않습니다.

먼저 Nginx가 시작되기 전에 PID 파일이 의도적으로 제거되는 것을 확인하십시오. 출력에서 게시 한 내용을 볼 수 있습니다 :

ExecStartPre=/usr/bin/rm -f /run/nginx.pid 

왜? 대답은 Nginx service file의 주석입니다 :

# Nginx will fail to start if /run/nginx.pid already exists but has the wrong 
# SELinux context. This might happen when running `nginx -t` from the cmdline. 
# https://bugzilla.redhat.com/show_bug.cgi?id=1268621 
ExecStartPre=/usr/bin/rm -f /run/nginx.pid 

그래서 Nginx에이 정상적으로 실행되는 경우 당신은 당신이/정지 잘 시작할 수 있습니다, 당신이 로그에 그 경고를 무시 수 있다고 생각합니다.

0

서버를 재부팅하면 오류가 해결되었습니다. 예쁜 것은 아니지만 효과가있었습니다.