2017-01-03 50 views
0

當我嘗試啓動NGINX時,我得到「nginx.service的作業失敗。有關詳細信息,請參閱'systemctl status nginx.service'和'journalctl -xn'。」這個錯誤怎麼回事? nginx

NGINX錯誤日誌:

2017/01/03 03:08:05 [emerg] 15144#0: unknown directive "index.php" in /etc/nginx/sites-enabled/default:33 2017/01/03 03:09:25 [emerg] 15214#0: unknown directive "index.php" in /etc/nginx/sites-enabled/default:33 2017/01/03 03:09:48 [emerg] 15224#0: unknown directive "index.php" in /etc/nginx/sites-enabled/default:33 2017/01/03 03:10:44 [emerg] 15237#0: unknown directive "index.php" in /etc/nginx/sites-enabled/default:33 2017/01/03 03:11:18 [emerg] 15253#0: unknown directive "index.php" in /etc/nginx/sites-enabled/default:33 2017/01/03 03:13:25 [emerg] 15321#0: unknown directive "index.php" in /etc/nginx/sites-enabled/default:33 2017/01/03 03:14:04 [emerg] 15345#0: unknown directive "index.html" in /etc/nginx/sites-enabled/default:33 2017/01/03 03:15:40 [emerg] 15369#0: unknown directive "index.php" in /etc/nginx/sites-enabled/default:35 2017/01/03 03:16:28 [emerg] 15393#0: unknown directive "index.php" in /etc/nginx/sites-enabled/default:37 2017/01/03 03:17:56 [emerg] 15421#0: unexpected "}" in /etc/nginx/sites-enabled/default:60 2017/01/03 03:18:25 [emerg] 15443#0: unexpected end of file, expecting ";" or "}" in /etc/nginx/sites-enabled/default:81 2017/01/03 03:19:14 [emerg] 15466#0: unexpected "}" in /etc/nginx/sites-enabled/default:80 2017/01/03 03:20:10 [emerg] 15489#0: unexpected "}" in /etc/nginx/sites-enabled/default:60 2017/01/03 03:22:06 [emerg] 15515#0: unexpected "}" in /etc/nginx/sites-enabled/default:60

默認聰: http://pastebin.com/APZCBJ5n

+0

歡迎來到Stack Overflow。請在發佈問題前多加努力:如果您閱讀錯誤輸出,有一條線索:2017/01/03 03:08:05 [emerg] 15144#0:未知指令「index.php」在/ etc/nginx/sites-enabled/default:33 - 基本上它在/ etc/nginx/sites-enabled/default的第33行表示它找到了一些它不理解的東西。 – Mikkel

回答

0

你應該放在一個指數指令默認的文件模式,你應該在服務器名稱後添加一個逗號指令。

所以修改你的配置是這樣的線28和29:

index index.php 
server_name www.streamingeverywhere.com; 
0

變化

root /var/www/html; 
    # Add index.php to the list if you are using PHP 
    index.php 

root /var/www/html; 
# Add index.php to the list if you are using PHP 
index index.php 

,你也缺少server_name指令;結束,

運行sudo nginx -t在執行任何nginx配置更改以檢查是否有任何錯誤,然後再應用於生產以重新啓動/重新加載nginx進程!