node.jswordpressapachevhostsmod-vhost-alias

Using wordpress for /blog route in nodejs website not working


I created a vhost like this in my apache2 server configuration:

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName test.co
    ServerAdmin webmaster@localhost

    #wordpress
    Alias /blog "/var/www/test_wp/public_html"

    <Directory "/var/www/test_wp/public_html">
       Options None
       AllowOverride None
       Order allow,deny
       Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    ProxyPreserveHost On
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/

    SSLCertificateFile /etc/letsencrypt/live/test.co/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/test.co/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

I'm using alias to redirect /blog url (test.co/blog) to wordpress folder in my server.

i'm using proxypass for the nodejs website.

But when i hit test.co/blog , it shows 404 not found, in my nodejs website


Solution

  • Follow this: Exclude an alias from virtualhost proxypass

    Add this line :

    ProxyPassMatch ^/blog !
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/