nginx忽略了我的网站配置

时间:2014-05-09 19:18:04

标签: nginx

我在dir /etc/nginx/sites-enabled

中创建了网站配置文件
server {
    listen 80;
    server_name domain.com;
    gzip_types application/x-javascript text/css;
    access_log /var/log/nginx/nodeApp.info9000p.access.log;
    location / {
        proxy_pass    http://127.0.0.1:9000/;
    }
    location ~ ^/(min/|images/|bootstrap/|ckeditor/|img/|javascripts/|apple-touch-icon-ipad.png|apple-touch-icon-ipad3.png|apple-touch-icon-iphone.png|apple-touch-icon-iphone4.png|generated/|js/|css/|stylesheets/|robots.txt|humans.txt|favicon.ico) {
          root /root/Dropbox/nodeApps/nodeApp/9000/appdirectory-build; 
          access_log off;
          expires max;
        }
}

并重新启动nginx:

sudo /etc/init.d/nginx restart

nginx忽略我的网站配置文件,并在我请求domain.com时显示默认页面:

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

2 个答案:

答案 0 :(得分:1)

您的Wordpress文件在哪里?

默认的nginx htdocs-root是/ usr / share / nginx / html

如果您已安装文件,例如 / usr / share / nginx / html / wordpress,,则必须更改文件/ etc / nginx / conf中的根设置。 d / default.conf到该目录,如下所示

server {
root /usr/share/nginx/html/wordpress;
}

请阅读https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-centos-7文章,了解如何设置nginx以使用套接字上的PHP引擎(CentOS),如果你还没有这样做的话。

答案 1 :(得分:0)

不知道怎么做,但我的配置开始运作良好。也许是因为我重新启动nginx而不是重新加载它。