I am trying to configure apache2 on aws lightsail instance. the instance was default setup for aws wordpress + aws linux. I have a node.js server running on port 5000 on this instance.
the apache server is in /opt/bitnami/apache2
.
First I tried to redirect port to 5000 for non-http requests ad it worked well.
here is the .conf file:
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName example.com
ServerAlias www.example.com
# setup the proxy
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass / http://example:5000/
ProxyPassReverse / http://example:5000/
</VirtualHost>
then I configured ssl certificate with bitnami bncert-tool. I turned force https redirect on while configuring ssl.
then i configured example-https.conf
like below:
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName example.com
ServerAlias www.example.com
SSLEngine on
SSLCertificateFile "/opt/bitnami/apache2/conf/example.com.crt"
SSLCertificateKeyFile "/opt/bitnami/apache2/conf/example.com.key"
# setup the proxy
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass / http://example.com:5000/
ProxyPassReverse / http://example.com:5000/
</VirtualHost>
but this time it's not working. requests are being redirected to https and resposes is from wordpress, not my node.js server.
these conf
files are in /var/www
and i have included them in httpd.conf
using
Include "/var/www/*.conf"