Skip to main content

SSL No 2





Hom



Let’s Encrypt SSL, Nginx, MUP → Deployment (Meteor)


Nginx used for SSL setup


Let’s Encrypt free SSL certificate:

Use the instructions on this page to use OpenSSL to create your certificate signing request (CSR) and then to install your SSL certificate on your Nginx server. Restart Note: After you've installed your SSL/TLS certificate and configured the server to use it, you must restart your Nginx instance.
Let’s start by generating

Add a A Record in your domain’s DNS Settings







Setting up Let’s Encrypt

  • ssh into your server console and run following commands
$ wget https://dl.eff.org/certbot-auto
$ chmod a+x certbot-auto
$ ./certbot-auto certonly -d yourdomain.com --standalone







After successful execution of the last command you can see your Certificate & Key generated in /etc/letsencrypt/yourdomain.com

Setting up Nginx

  • Let’s install nginx which will be our proxy server
$ sudo apt-get install nginx
  • Use nano to create / edit your domain’s nginx settings:
$ sudo nano /etc/nginx/sites-enabled/yourdomain.com.conf
Below is the code that tells the server what to do. We listen to port 80 for domain.com and 301 redirect that to https://yourdomain.com, append the requested uri and listen on port 443 for our ssl set up.






Now check your nginx settings. 

Run:  $ sudo nginx -t



That should return


nginx: the configuration file /etc/nginx/nginx.conf syntax is ok


nginx: configuration file /etc/nginx/nginx.conf test is successful



If it returns an error, nginx will tell you which file and line number contains the error. Simply sudo nano to edit the file at the path name.



Now you have to restart nginx and you’ll be up and running.

$ sudo service nginx restart

Setting up MUP
Installing mup
$ npm install -g mup
You can create a directory .deploy in your project and initialize MUP
$ mkdir .deploy
$ mup init
After mup init following file will be generated and then you can edit it according to your needs.






MUP Config

yourdomain.com.conf file
server {
   ...
   location {
      ...
      proxy_pass http://localhost:3000;
      ...
   }
   ...
}
mup.js
meteor {
   ...
   env {
      ...
      PORT: 3000,
      ROOT_URL: http://localhost
      ...
   }
   ...
}
Keep in mind we will have to use the same ROOT_URL & PORT in MUP env and yourdomain.com.conf file
$ mup setup







$ mup deploy







Your app is deployed and you can access it on https://yourdomain.com.







References:


Qbatch
Never miss a story from Qbatch, when you sign up for Medium. Learn more

Comments

Popular posts from this blog

curl http://localhost:8042/studies/333b2c11-52e9feea-5516186e-ecd61f37-69da2603  curl http://localhost:8042/patients/dc65762c-f476e8b9-898834f4-2f8a5014-2599bc94 bird@bird-Lenovo-ideapad-310-15IKB:/media/bird/2AE477A5E4777245/Meteor/OrthancMirror/build$ curl http://localhost:8042/patients [    "333b2c11-52e9feea-5516186e-ecd61f37-69da2603",    "da39a3ee-5e6b4b0d-3255bfef-95601890-afd80709" ] bird@bird-Lenovo-ideapad-310-15IKB:/media/bird/2AE477A5E4777245/Meteor/OrthancMirror/build$ curl http://localhost:8042/studies [    "9b5629ef-c28c48db-b3593009-35fda9cb-7a0bb799",    "abae0b24-5a718d9e-1b560140-2cda3ae0-30b846cb" ] bird@bird-Lenovo-ideapad-310-15IKB:/media/bird/2AE477A5E4777245/Meteor/OrthancMirror/build$  curl http://localhost:8042/series [    "993a521c-1b11574c-92e1c71d-a048784c-36866be0",    "5f19601c-3e5fa872-e566e9f2-36aa3b31-dc719c3e" ] bird@bird-Lenovo-ideapad-310-15IKB:/med...

Android Commands

meteor run android-device --mobile-server="https://sitename.com" metero build (BUIld Path/home/bird/Downloads/Meteor/bit/uploads ) --server="https://sitename.com"

Using LetsEncrypt to install free SSL on AWS server ec2 machine( Meteor version 1.6)

Installation of meteor project on AWS could be a real headache if you are not familiar with AWS environment. But with the help of various blogs on Medium, you can Do the installation and your project would be live. But there is one more thing that usually causes severe pain for Developers. that is the installation of SSL certificate. Most of the content on the web is almost 2-3 years old. So many things got changed since then. so we felt an utter need for a blog that could guide us through this process. let's start. 1. Login with SSH command on your Ubuntu machine. 2. Go to your project directory by typing cd /var/www/html/ 3. go inside your project and then in app-deploy folder. Now run mup stop command to stop the current instance that is running on the server. Now go out with cd .. command to HTML folder( cd /var/www/html/ ). 4. Now install LetsEncrypt on your virtual machine. type this command git clone https://github.com/letsencrypt/letse...