繁体   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