Apache reverse proxy for web app
Apache reverse proxy for web app
Let's imagine that we've just finished developping a NodeJS application that listens for HTTP requests on port 8086 and that we have an Apache2 instance listening on port 80.
It is possible to configure Apache so that it connects its clients to the NodeJS app using the proxy module. Here is an example configuration file that does so:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName app.example.com
# SSL configuration
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/app.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/app.example.com/privkey.pem
# Proxy config
SSLProxyEngine On
ProxyPass / http://localhost:8086/
ProxyPassReverse / http://localhost:8086/
</VirtualHost>
</IfModule>