We are using an AMI provided by Bitnami that consists of our MEAN stack deployed on an Ubuntu server. We recently purchased an SSL certificate from GoDaddy which we were trying to install on our Amazon EC2 server. We installed the certificates successfully on the Apache server by setting up
conf/extra/httpd-ssl.conf under the apache2 folder.
However, when we go to
https://zywie.org, it redirects the user to the default Bitnami webpage, not the Zywie application.
Our MEAN stack application runs at port 9000. We had a similar problem with the HTTP so we ran the following and this solved it
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to 9000
For https we executed a similar command (see below) but with no luck.
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to 9000
For now, our MEAN stack application can be accessed at
http://www.zywie.org. Likewise, we want the HTTPS to forward to 9000 too.
Can you please let us know how to fix this?
NOTE: The steps below assume that you are using a custom domain name and that you have already configured the custom domain name to point to your cloud server. In the following steps, replace the APPNAME placeholder with the name of your application directory.
Bitnami images come with SSL support already pre-configured and with a dummy certificate in place. Although this dummy certificate is fine for testing and development purposes, you will usually want to use a valid SSL certificate for production use. You can either generate this on your own (explained here) or you can purchase one from a commercial certificate authority.
Once you obtain the certificate and certificate key files, you will need to update your server to use them. Follow these steps to activate SSL support:
1.- Use the table below to identify the correct locations for your certificate and configuration files.
<strong>Current application URL</strong>
<strong>Nginx configuration file</strong>
<strong>Certificate key file</strong>
2.-Copy your SSL certificate and certificate key file to the specified locations.
3.- Once you have copied all the server certificate files, you may make them readable by the root user only with the following commands:
sudo chown root:root /opt/bitnami/apps/APPNAME/conf/certs/server* sudo chmod 600 /opt/bitnami/apps/APPNAME/conf/certs/server*
4.- Open port 443 in the server firewall. Refer to the FAQ for more information.
5.- Restart the Nginx server.
sudo /opt/bitnami/ctlscript.sh restart nginx
You should now be able to access your application using an HTTPS URL.