nginx忽略我的站点配置

nginx忽略我的站点配置,nginx,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://12

我在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重启

但是
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.

不知道如何,但我的配置开始运行良好。可能是因为我重新启动了nginx而不是重新加载它。

你的Wordpress文件在哪里

默认的nginx htdocs根目录是/usr/share/nginx/html

如果您已经将文件安装在,比如说,/usr/share/nginx/html/wordpress,那么您必须将文件/etc/nginx/conf.d/default.conf中的root设置更改为该目录,如下所示

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

如果您尚未使用PHP engine over socket(CentOS),请阅读关于如何设置nginx以使用PHP engine over socket(CentOS)的文章。

您的
位置
块的正则表达式非常具体。为什么你希望它能在里面的东西之外工作呢?这个正则表达式只适用于css和js,其余的请求应该被代理到localhost:9000。同一配置在另一台服务器上工作正常。请检查DNS。检查协议。请检查您的浏览器是否未向您的请求添加
www
前缀。此问题似乎属于Stack Exchange网络中的另一个站点,因为它与编程无关。也许是。