[英]Apache proxy to Lighttpd: changing $_SERVER['HTTP_HOST'] in php
I have a WordPress blog running on lighttpd-1.4.19, listening at www00:81. 我有一个运行在lighttpd-1.4.19上的WordPress博客,其网址为www00:81。 On the same host, apache-2.2.11 listens on port 80, which creates a proxy connection from
http://blog.mydomain.org:80
to http://blog.mydomain.org:81
(both being the same physical machine). 在同一主机上,apache-2.2.11侦听端口80,该端口创建从
http://blog.mydomain.org:80
到http://blog.mydomain.org:81
的代理连接(两者都是相同的物理端口)机)。
The Apache virtualhost looks as follows: Apache虚拟主机如下所示:
<VirtualHost *:80>
ServerName blog.mydomain.org
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://blog.mydomain.org:81/
ProxyPassReverse / http://blog.mydomain.org:81/
</VirtualHost>
Using debug.log-request-handling = "enable"
, I get the following log entry when I browse http://blog.mydomain.org:80
(notice the Host
headers): 使用
debug.log-request-handling = "enable"
,浏览http://blog.mydomain.org:80
时,会得到以下日志条目(请注意Host
标头):
2010-05-10 08:47:14: (request.c.294) fd: 6 request-len: 853
GET / HTTP/1.1
Host: blog.mydomain.org:81
[...]
2010-05-10 08:47:15: (request.c.294) fd: 8 request-len: 754
GET /wp-content/uploads/2010/01/image.gif?w=280 HTTP/1.1
Host: www00:81
My problem: as far as I know, the PHP environment variable $_SERVER['HTTP_HOST']
is set to that Host
header variable. 我的问题:据我所知,PHP环境变量
$_SERVER['HTTP_HOST']
设置为该Host
标头变量。 Unfortunately, WordPress uses that variable in their system to create URLs to pictures on the blog. 不幸的是,WordPress在其系统中使用该变量来创建指向博客上图片的URL。 These URLs won't be accessible behind a firewall of course.
当然,在防火墙后将无法访问这些URL。 How can I force the host header to be
blog.mydomain.org
instead of blog.mydomain.org:81
, respectively www00:81
? 如何强制将主机标头分别为
blog.mydomain.org
而不是blog.mydomain.org:81
和www00:81
? I already added set server.name = "blog.mydomain.org"
to my lighttpd.conf
, but this didn't work. 我已经将
set server.name = "blog.mydomain.org"
到了我的lighttpd.conf
,但这没有用。
Any suggestions are appreciated, thank you. 任何建议表示赞赏,谢谢。
Have you tried editing your wp-config.php
? 您是否尝试过编辑
wp-config.php
? It should be possible to override the automatic host detection. 应该可以覆盖自动主机检测。
Namely: 即:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.