13000

Installing SSL on AWS EC2 Bitnami Mean Stack

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?

Thanks

Answer1:

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> https://[custom-domain]/

<strong>Nginx configuration file</strong> /opt/bitnami/apps/APPNAME/conf/APPNAME.conf

<strong>Certificate file</strong> /opt/bitnami/apps/APPNAME/conf/certs/server.crt

<strong>Certificate key file</strong> /opt/bitnami/apps/APPNAME/conf/certs/server.key

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.

Recommend

  • SONARQUBE editor tab in eclipse shows nothing
  • Is it possible to access ip fragments with libnetfilter_queue
  • iptables redirect all requests to localhost
  • Appropriate iptables rules for an FTP server in active \\ passive mode
  • selective proxy port forwarding on Apache httpd
  • PhpStorm/Xdebug not stop in breakpoints
  • Install ssh server on embedded device
  • Undefined Offet Error in cURL Code
  • How to make a dhcp server listen for broadcast requests in a virtual box vm
  • How to handle mirrored(duplicated) iptables traffic after TEE?
  • How do I get an image w/ the exact size in pixels, when using bbox_inches='tight' in matpl
  • iptables 1.4.11 on Android
  • Proving if n = m and m = o, then n + m = m + o in Idris?
  • PDO connection to MySQL database refused
  • Cannot log in using SQL authentication ONLY from a remote server
  • How can I set the buffer size for the underneath Socket UDP?
  • GDB skips over my code!
  • Can you use multiple instances of Edge on a Selenium Grid Node?
  • python & Mysql: unsupported operand type(s) for -: 'int' and 'tuple'
  • How to startActivity for Result from Activity under Group Activity Under Tabs?
  • proxy request in node.js / express
  • Installing SSL on AWS EC2 Bitnami Mean Stack
  • Symfony2 redirect to https route fails (uses wrong port)
  • Rails 3.2 from SQLite locally to Postgres on Heroku
  • Typecasting `this` of a base class template to its derived class
  • XBee Linux Serial Port on Rasberry Pi
  • how do you obtain the address of an instance after overriding the __str__ method in python
  • Get current user from inside the model in Sails
  • node.js POST request fails
  • CORS with socket.io
  • How can I run DataNucleus Bytecode Enhancer from SBT?
  • Prevent Tomcat from caching request during starup
  • Jquery Knockout: ko.computed() vs classic function?
  • pip in virtualenv gets ConnectTimeoutError
  • Element.tagName for python not working
  • Access Android Market through SSH tunnel
  • Inline R code in YAML for rmarkdown doesn't run
  • How to run “Deployd” on port 80 instead of port 5000 in webserver.
  • ActionScript 2 vs ActionScript 3 performance
  • need help with bizarre java.net.HttpURLConnection behavior