简体   繁体   中英

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. 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).

The Apache virtualhost looks as follows:

<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):

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. Unfortunately, WordPress uses that variable in their system to create URLs to pictures on the blog. These URLs won't be accessible behind a firewall of course. How can I force the host header to be blog.mydomain.org instead of blog.mydomain.org:81 , respectively www00:81 ? I already added set server.name = "blog.mydomain.org" to my lighttpd.conf , but this didn't work.

Any suggestions are appreciated, thank you.

Have you tried editing your wp-config.php ? It should be possible to override the automatic host detection.

Namely:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM