skip to Main Content

I have installed and configured WordPress on my server using also apach2 virtualhosts.
I made a virtualhost with this config

<VirtualHost *:80 *:443>

    ServerAdmin [email protected]
    ServerName yourluxuryroad.com
    ServerAlias www.yourluxuryroad.com
    DocumentRoot /var/www/yourluxuryroad
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    RewriteEngine on
    RewriteCond %{SERVER_NAME} =www.yourluxuryroad.com [OR]
    RewriteCond %{SERVER_NAME} =yourluxuryroad.com
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

    ProxyPreserveHost On
    ProxyRequests Off
    ProxyPass /node-yrl-book http://localhost:5000
    ProxyPassReverse /node-yrl-book http://localhost:5000

</VirtualHost>

<Directory /var/www/yourluxuryroad/>
    AllowOverride All
</Directory>


As you can see from the config i’m trying to set the ProxyPass directive for redirect the requests recived on the path /node-yrl-book to a nodejs service ( made using expressjs ) at port 5000 but this is not working, instead of getting a redirect to that service i get the 404 Page not found wordpress page.

If I make a request at my_ip/node-yrl-book instead it works correctly and i am redirected to the service at port :5000

I suppose that i’m missing something in my configuration but i’m not understanding what..
Maybe is something in wordpress that has to be changed?

2

Answers


  1. Chosen as BEST ANSWER

    Finally i solved this, I made an SSL certificate for my website using let's encrypt certbot, This script created a new virtualhost in another file for the https requests ( called /etc/apache2/sites-available/myDomain-le-ssl.conf ) That virtualhost was overriding my proxypass directive, editing also this virtualhost made all work


  2. You have way too much going on.

    ProxyPass -or- DocumentRoot, not both.

    You can either serve the page from apache (by using DocumentRoot), or you can serve the page from nodejs (by using ProxyPass).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search