Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Nginx正在转发到apache2,但用户获得的url为:3000_Php_Wordpress_Apache_Nginx - Fatal编程技术网

Php Nginx正在转发到apache2,但用户获得的url为:3000

Php Nginx正在转发到apache2,但用户获得的url为:3000,php,wordpress,apache,nginx,Php,Wordpress,Apache,Nginx,在设置apache2监听端口3000和服务器php文件(wordpress)点击blog.mysite.com后:3000加载我的wordpress安装没有问题。然后我在端口80上设置nginx作为apache的代理。这很好,我唯一的问题是,当用户点击blog.mysite.com时,它会被重定向到blog.mysite.com:3000,而这不是期望的行为。在网上寻找一些解决方案,包括在我的wp-config.php中添加一些php代码,但没有成功。有什么帮助吗 编辑: server {

在设置apache2监听端口3000和服务器php文件(wordpress)点击blog.mysite.com后:3000加载我的wordpress安装没有问题。然后我在端口80上设置nginx作为apache的代理。这很好,我唯一的问题是,当用户点击blog.mysite.com时,它会被重定向到blog.mysite.com:3000,而这不是期望的行为。在网上寻找一些解决方案,包括在我的wp-config.php中添加一些php代码,但没有成功。有什么帮助吗

编辑:

server {
        listen       80 default_server;
        server_name  appsrd.devmbs.com;
        root /home/ubuntu/projecs/APPS-RD;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /home/ubuntu/projects/APPS-RD;
            index  index.html index.htm index.php;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        location ~ \.php$ {
        proxy_pass   http://127.0.0.1:3000;
        proxy_buffering on;
        proxy_buffers 12 12k;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect  http://appsrd.devmbs.com:3000   http://appsrd.devmbs.com;

        }
}
编辑:

server {
        listen       80 default_server;
        server_name  appsrd.devmbs.com;
        root /home/ubuntu/projecs/APPS-RD;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /home/ubuntu/projects/APPS-RD;
            index  index.html index.htm index.php;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        location ~ \.php$ {
        proxy_pass   http://127.0.0.1:3000;
        proxy_buffering on;
        proxy_buffers 12 12k;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect  http://appsrd.devmbs.com:3000   http://appsrd.devmbs.com;

        }
}
/正在显示wp admin,但站点的根目录正在重定向循环中运行

127.0.0.1---[03/Sep/2012:12:29:25+0000]“GET/index.php HTTP/1.0”301 529http://appsrd.devmbs.com/wp-admin/options-general.php“Mozilla/5.0(Macintosh;英特尔Mac OS X 10_8_0)AppleWebKit/537.1(KHTML,类似Gecko)Chrome/21.0.1180.89 Safari/537.1”

这个请求被炒了12到15次

编辑:

server {
        listen       80 default_server;
        server_name  appsrd.devmbs.com;
        root /home/ubuntu/projecs/APPS-RD;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /home/ubuntu/projects/APPS-RD;
            index  index.html index.htm index.php;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        location ~ \.php$ {
        proxy_pass   http://127.0.0.1:3000;
        proxy_buffering on;
        proxy_buffers 12 12k;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect  http://appsrd.devmbs.com:3000   http://appsrd.devmbs.com;

        }
}

最奇怪的是,我删除了数据库并进入,重定向循环消失了,我得到一条消息,wordpress找不到应该发生的DB。然后我创建了一个新的数据库,运行wordpress安装,同样的情况也出现了。管理员工作正常,但站点页面出现重定向循环。

问题是,在wordpress设置中,我的地址错误,所以它在url末尾添加了:3000。由于此问题的标题不再代表我当前的问题,我将关闭它并创建一个新问题。

您是否检查了“常规设置”中的网站地址/Wordpress地址是否正确?我猜它不应该包括:3000Lol,这似乎是问题所在,在wordpress设置中,网址在url中有:3000,我删除了它,但现在只有wp管理员工作。网站没有显示。你能发布你的ngninx配置吗?您在访问日志中看到了什么?添加了nginx.conf,哪些访问日志应该查看nginx访问日志或apache访问日志?检查了访问权限,如果我访问该站点,日志显示为连续10次访问,那么我在浏览器上看到此消息此网页有一个重定向循环。