2016-08-02 299 views
0

我已經使用「apk添加nginx」在Alpine上安裝了nginx。出於某種原因,系統啓動時。 Nginx崩潰。我查了日誌中 /var/log/nginx/error.logs,這是輸出:Nginx在啓動時崩潰

2016/07/27 12:54:59 [emerg] 7944#0: bind() to 0.0.0.0:80 failed (98: Address in use) 
    2016/07/27 12:54:59 [emerg] 7944#0: bind() to 0.0.0.0:8080 failed (98: Address in use) 
    2016/07/27 12:54:59 [emerg] 7944#0: still could not bind() 

當我使用須藤netstat的-nltup | grep的:80

tcp 0  0 127.0.0.1:80   0.0.0.0:* LISTEN 5264/nginx.conf 
    tcp 0  0 0.0.0.0:8080   0.0.0.0:* LISTEN 5033/nginx.conf 
    tcp 0  0 :::80     :::* LISTEN 5033/nginx.conf 

我使用 sudo的定影-k 8080/TCP殺害的過程在8080。死亡進程的ID是。即使在那之後,我運行 sudo service nginx start。給了我同樣的錯誤:

* Starting nginx ... 
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use) 
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use) 
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use) 
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use) 
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address in use) 
    nginx: [emerg] still could not bind() 
    * start-stop-daemon: failed to start `/usr/sbin/nginx' 
    * Failed to start nginx                  
    * ERROR: nginx failed to start 
+0

所以你殺了:8080點的過程,但不是80? –

+0

您使用的是什麼操作系統和控制面板? –

+0

在'/ etc/nginx/sites-enabled'中檢查你的配置' –

回答

0

這裏是速戰速決,如果你希望得到您的Nginx爲現在的工作,但這不是長久之計,如果重新啓動服務器,然後再次運行同一命令讓nginx再次生活。

這會殺口98個過程

fuser -k 98/tcp 
service nginx start 
+0

端口98從開始就很麻煩,所以必須首先殺死命令運行的進程,然後重新啓動nginx才能正常工作 –

+0

G我試過了你上面提到的那些命令,但是沒有成功。獲取相同的錯誤。 –