【发布时间】:2014-02-08 08:38:08
【问题描述】:
我正在尝试按照tutorial 在运行 Ubuntu 12.0.4.3 x32 的 VPS 上安装 LEMP 堆栈。当我尝试重新启动 nginx 时收到以下错误消息:
Restarting nginx: nginx: [emerg] unknown directive "http://wiki.nginx.org/QuickStart" in
/etc/nginx/sites-enabled/default:21
nginx: configuration file /etc/nginx/nginx.conf test failed
这让我在逻辑上假设我的 nginx.conf 有问题,如下所示:
GNU nano 2.2.6 File: /etc/nginx/sites-available/default Modified
root /usr/share/nginx/www;
index index.php index.html index.htm;
server_name 192.XXX.XXX.X;
location / {
try_files $uri $uri/ /index.html;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
我也无法在我创建的浏览器中打开 info.php。
你能告诉我出了什么问题吗?
【问题讨论】:
-
错误的另一部分是 in /etc/nginx/sites-enabled/default 第 21 行。您也应该检查那里。
-
能否请您也分享一下
/etc/nginx/nginx.conf,因为这个文件看起来不错 -
刚刚发现错误;第一行未注释,因此文件被拒绝。问题解决了。