从公共IP地址访问网站时只能看到“欢迎来到nginx”

时间:2014-06-06 12:00:46

标签: php wordpress nginx

当我通过localhost或本地局域网地址访问我的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;
        }
}

如何开始调试?

1 个答案:

答案 0 :(得分:1)

由于你的try_files有$ uri作为第一个参数,你将在你的/ var / www中点击index.html,这将满足这个要求,所以如果你把php-argument放在第一位,或者转到:

http://123.123.123.123/index.php 

你应该看到你的wordpress网站。

相关问题