【问题标题】:Error message when trying to install nginx on Ubuntu 12.04.3 x32尝试在 Ubuntu 12.04.3 x32 上安装 nginx 时出现错误消息
【发布时间】: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,因为这个文件看起来不错
  • 刚刚发现错误;第一行未注释,因此文件被拒绝。问题解决了。

标签: ubuntu nginx vps


【解决方案1】:

这里有一个关于installing LEMP Stack on Ubuntu 的正确指南,如果这不能帮助您输入 sudo nginx -t 这将告诉您配置文件中的错误。

【讨论】:

    猜你喜欢
    • 2014-02-08
    • 1970-01-01
    • 2018-10-27
    • 2021-11-18
    • 1970-01-01
    • 1970-01-01
    • 2023-03-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多