只看到'欢迎使用nginx'当从公共IP地址访问站点时


only see 'welcome to nginx' when accessing site from public ip address

当我通过localhost或本地LAN地址访问我的wordpress网站时,一切正常工作。但是当我从外部访问它时,像这样:http://123.123.123/(其中123.123.123是我的公共ip)我只得到Welcome to nginx页。然而,如果我访问http://123.123.123/wordpress,我确实得到一个wordpress页面。

怎么了?下面是我的nginx配置:

server {
        listen   80;

        root /var/www/;
        index index.php index.html index.htm;
        server_name 123.123.123.123;
        location / {
                try_files $uri $uri/ /index.php?q=$uri&$args;
        }
        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 a UNIX socket
        location ~ '.php$ {
                #fastcgi_pass 127.0.0.1:9000;
                # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
}

我如何开始调试这个?

因为你的try_files有$uri作为第一个参数,你会点击/var/www中的index.html,这就满足了,所以如果你把php参数放在第一位,或者转到:

http://123.123.123.123/index.php 

你应该看到你的wordpress站点。