April 2, 2026 •
3 min readMake sure your server already has
nodeandnpminstalled before starting._
Add an A record in your DNS settings:
Type: A
Host: @
Value: YOUR_SERVER_IPGo to Hestia > Web > Add domain, then enable all SSL-related fields.
Your web root will look like this:
/home/nirmal/web/test.com/ssh root@your-server-ippublic_htmlcd /home/nirmal/web/test.com/public_htmlgit clone <your-repo> .
cd my-sitenpm install
npm run build
pm2 start npm --name next-app -- startAt this point, the app runs on:
http://127.0.0.1:3000When I visited the domain, I got:
Cannot serve directory /home/nirmal/web/test.com/public_html/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
Apache tried to serve static files from public_html, so it failed.
Do not edit the default *.ssl.conf or other default config files.
Create a custom file to forward traffic to your Next.js app on port 3000:
nano /home/nirmal/conf/web/test.com/apache2.ssl.conf_customAdd:
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/When i visited the site i got 500 error, when I checked logs which resides here:
tail -n 50 /var/log/apache2/domains/test.com.error.logI saw this:
[Thu Apr 02 05:54:38.221879 2026] [proxy:warn] [pid 2246621:tid 2246666] [client 103.166.100.206:0] AH01144: No protocol handler was valid for the URL / (scheme 'http'). If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule. [Thu Apr 02 05:54:38.221933 2026] [proxy:warn] [pid 2246621:tid 2246666] [client 103.166.100.206:0] AH01144: No protocol handler was valid for the URL /error/50x.html (scheme 'http'). If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
Isn't it concerning?
Apache is trying to proxy requests to your Node.js backend, but it does not have the required protocol handler enabled to talk HTTP to that backend.
In short: Apache knows it should proxy, but it does not know how to proxy HTTP yet.
a2enmod proxy
a2enmod proxy_http
a2enmod headers
systemctl restart apache2proxy lets Apache forward requests.proxy_http adds HTTP proxy support (this fixes the AH01144 500 issue).headers helps Apache handle request headers correctly for app backends.Without these modules, reverse proxying will not work.
systemctl restart apache2
systemctl restart nginx
pm2 restart allss -tulnp | grep -E ':80|:443|:8443'Architecture:
Browser -> Nginx (443) -> Apache (8443) -> Next.js (3000)Nginx forwards traffic.
Apache decides routing and proxy behavior.
So once Apache was configured correctly, the site worked.
Happy coding!