简体   繁体   English

Apache httpd上的选择性代理端口转发

[英]selective proxy port forwarding on Apache httpd

I am trying to integrate wordpress into my site which is running on Nodejs server with Apache Httpd port forwarding enabled to forward all the request from 80 port to Nodejs port 9000. I have installed wordpress into Apache httpd /www/blog folder. 我正在尝试将wordpress集成到我的站点,该站点在Nodejs服务器上运行,启用Apache Httpd端口转发,将所有请求从80端口转发到Nodejs端口9000.我已将wordpress安装到Apache httpd / www / blog文件夹中。

Now, i want to edit my httpd.conf so that all my requests coming from client should still be forwarded to nodejs server except my blog.example.com calls which should not be proxy forwarded and they should point to /www/blog folder. 现在,我想编辑我的httpd.conf,以便来自客户端的所有请求仍然应该转发到nodejs服务器,除了我的blog.example.com调用,它们不应该被代理转发,它们应该指向/ www / blog文件夹。 Is this possible ? 这可能吗 ?

Here is the Virtualhost code from httpd.conf :- 这是httpd.conf中的Virtualhost代码: -

    <VirtualHost *:80>
        ProxyPreserveHost On
        ProxyPass / http://localhost:9000/
        ProxyPassReverse / http://localhost:9000/
        ServerName example.com
    </VirtualHost>

Any help would be appreciated. 任何帮助,将不胜感激。

This worked for me. 这对我有用。 Might be of some help for others. 可能对别人有所帮助。

    <VirtualHost *:80>
         RewriteEngine on
         RewriteCond %{HTTP_HOST} ^blog\.example\.com
         RewriteRule ^(.*)$ http://www\.example\.com/blog/$1 [L]

         ProxyPreserveHost On
         ProxyPass /blog !
         ProxyPass / http://localhost:9000/
         ProxyPassReverse / http://localhost:9000/
         ServerName example.com
    </VirtualHost>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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