簡體   English   中英

有問題的Nginx配置

[英]Problematic Nginx config

我為使用ngnix運行HHVM的Ubuntu 14.04 VPS設置了以下ngnix配置:

server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;

root /home/lephenix/main_website;
index.php index.html index.htm;

# Make site accessible from http://localhost/
server_name localhost;
include hhvm.conf;

location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ /index.php?q=$uri&$args;
    # Uncomment to enable naxsi on this location
    # include /etc/nginx/naxsi.rules
}
}

問題是,當我啟用此配置時,我從ngnix收到錯誤:

2014/09/07 13:16:01 [emerg] 13584#0: unknown directive "index.php" in /etc/nginx/sites-enabled/default:6

我看了,這似乎是這種配置的正確結構。 即使我刪除index.php,錯誤也會變為:

2014/09/07 13:17:03 [emerg] 13648#0: unknown directive "index.html" in /etc/nginx/sites-enabled/default:6

我按照以下指南設置服務器: http//webdevstudios.com/2014/07/17/setting-up-wordpress-nginx-hhvm-for-the-fastest-possible-load-times/

在此先感謝您的幫助

它需要是:

index index.php index.html index.htm

該指令是“索引”。

此外,“try_files”是錯誤的。 改成:

try_files $uri $uri/ /index.php$is_args$args

配置文件正確縮進也更好。 它使調試更容易。

我懷疑你所遵循的教程是錯誤的,它肯定是無效的,因為在嘗試為其分配內容之前,需要首先命名指令。

可能會給教程作者彈出一個注釋嗎? 對他們來說糾正它真是太好了,所以沒有其他人會對這個問題有所了解:)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM