不会发图= =
//nginx 部分配置
upstream apache2_svr {
    server 127.0.0.1:8088;
}
server {
    listen       80;
    server_name  ws.com;
    location / {
        deny all;
    }
    location /wp {
        proxy_set_header Host $host;
        proxy_pass http://apache2_svr/wp;
    }
}
#地址栏显示 http://ws.com:8088/wp/
这是什么原因导致的呢?还有就是有时候还会直接跳转到外网。。。
|      1kanchi240      2016-03-31 15:27:22 +08:00 proxy_pass http://apache2_svr/wp; 改为: proxy_pass http://apache2_svr ; 试试 | 
|      2sualwu      2016-03-31 15:41:39 +08:00 via Android 配下 proxy_redirect ? | 
|  |      3sen506 OP @sualwu  加了后发现可以。。 不过有点懵 B 。。 fildder 抓包发现返回的数据显示是跳到了 8088, 但页面却正常打开。。 ``` <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301 Moved Permanently</title> </head><body> <h1>Moved Permanently</h1> <p>The document has moved <a href="http://ws.com:8088/wp/">here</a>.</p> <hr> <address>Apache/2.4.10 (Ubuntu) Server at ws.com Port 8088</address> </body></html> ``` | 
|      5kanchi240      2016-03-31 16:03:47 +08:00 确认下你的配置是否就是: proxy_set_header Host $host; | 
|      7kanchi240      2016-03-31 16:06:48 +08:00 nginx 监听的是 80 端口吗? | 
|  |      8sen506 OP @kanchi240 是的, 后端是 apache2, 监听 8088, 这个配置之前不加 proxy_redirect 的时候时好时坏,有时候可以正确重定向, 有时候不行。。 | 
|      9kanchi240      2016-03-31 16:29:10 +08:00 把 upstream 配置去掉, proxy_pass 直接改为 proxy_pass http://127.0.0.1:8088; 试试 | 
|      10BOYPT      2016-03-31 16:37:48 +08:00 这个跟 nginx 的配置无关,你的 wordpress 的数据库里面已经写了的这个博客的地址是 ws.com:8088 ,所以不管怎么转发,最终浏览器执行的都是 wordpress 的路径。 | 
|  |      11lhbc      2016-03-31 17:09:25 +08:00 你的 HTML 源码里有端口 跟 nginx 没有关系 | 
|  |      12sen506 OP @BOYPT  @lhbc 数据库里面的地址并没有加端口的。。 ``` mysql> select * from wp_options limit 0, 2; +-----------+-------------+------------------+----------+ | option_id | option_name | option_value | autoload | +-----------+-------------+------------------+----------+ | 1 | siteurl | http://ws.com/wp | yes | | 2 | home | http://ws.com/wp | yes | +-----------+-------------+------------------+----------+ ``` @kanchi240 直接把地址填上去, 应该跟 upstream 是一样的吧=。= | 
|  |      13maxsec      2016-03-31 21:53:53 +08:00 via iPad 你后端应用有主动跳转绝对地址? |