我为使用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/
提前感谢您提供任何帮助
答案 0 :(得分:10)
需要:
index index.php index.html index.htm
该指令是" index"。
此外," try_files"是错的。改为:
try_files $uri $uri/ /index.php$is_args$args
配置文件正确缩进也更好。它使调试变得更加容易。
我怀疑你所遵循的教程是错误的,它肯定无效,因为在尝试为其分配内容之前,需要首先命名指令。
可能会向教程作者弹出一个注释吗?对他们来说纠正它是好的,所以没有其他人可以解决这个问题:)