Вопрос

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.

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. Is this possible ?

Here is the Virtualhost code from httpd.conf :-

    <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 с атрибуция
Не связан с StackOverflow
scroll top