I created the sites-available and site-enabled folders, I added the site.domain.com.conf file with a virtualhost in my domain site.domain.com to do reverse proxy in a Nuxt node.js application, which is running successfully on localhost:3000. I made the following configuration:

<VirtualHost *:80>
    ServerName site.domain.com
    ServerAlias www.site.domain.com

    DocumentRoot /var/www/html
    ErrorLog /home/user01/site.domain.com/error.log
    CustomLog /home/user01/site.domain.com/access.log combined

    ProxyRequests off
    <Proxy *>
     Require all granted

    ProxyPreserveHost on
    ProxyPass / http://localhost:3000/ retry=1 acquire=3000 timeout=3000 keepalive=off
    ProxyPassReverse / http://localhost:3000/
    ProxyTimeout 3000
    ProxyVia full

I also added the following line in the httpd.conf file

IncludeOptional sites-enabled/*.conf

And after restarting apache it created the requests.log and access.log files in the folder I configured in the ErrorLog and CustomLog parameters, so the configuration was read by apache.

When accessing the domain site.domain.com it does not point the requests to localhost: 3000, it just displays the directory files in the browser, what am I doing wrong?

Server settings:

  • CentOS 6.9
  • Apache 2.4.39
  • Enabled modules: proxy_module, proxy_http_module, lbmethod_byrequests_module, proxy_balancer_module

This is the result of the apachectl -S command:

port 80 namevhost site.domain.com (/etc/apache2/conf/httpd.conf:761)
                 alias www.site.domain.com

port 443 namevhost site.domain.com (/etc/apache2/conf/httpd.conf:1881)
                     alias www.site.domain.com

*:80                   site.domain.com (/etc/apache2/sites-enabled/site.domain.com.conf:1)

Notice that my virtual host configuration was added to the end, but still shows two other default settings, is it normal?


I was able to solve the problem by following the excellent cPanel documentation, I hope it can help someone else. Remembering that the includename.conf files can not count the VirtualHost tag, just the content inside it.


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.