dte66654
dte66654
2017-01-03 03:27
浏览 166
已采纳

什么是这个错误? nginx [关闭]

when i try to start NGINX i get "Job for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details."

NGINX ERROR LOG:

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

Default CONG: http://pastebin.com/APZCBJ5n

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dongyuling0312
    dongyuling0312 2017-01-03 04:12
    已采纳

    You should place the default file pattern in a index directive, and you should add a comma after a server_name directive.

    So modify your config like this in line 28 and 29:

    index index.php
    server_name www.streamingeverywhere.com;
    
    点赞 评论
  • dongwei9365
    dongwei9365 2017-01-03 04:13

    Change

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

    to

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

    and also you are missing ; end of server_name directive,

    run sudo nginx -t after doing any nginx config changes to check for any errors before applying to production for restarting/reloading the nginx process !

    点赞 评论

相关推荐