Skip to content

Instantly share code, notes, and snippets.

@jamiewilson
Last active July 26, 2025 16:30
Show Gist options
  • Save jamiewilson/4e1d28f9a200cb34ad59 to your computer and use it in GitHub Desktop.
Save jamiewilson/4e1d28f9a200cb34ad59 to your computer and use it in GitHub Desktop.

Revisions

  1. jamiewilson revised this gist May 14, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion deploying-meteor-apps.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #Deploying a Meteor app to Digital Ocean
    # Deploying a Meteor app to Digital Ocean

    #### Table of Contents

  2. jamiewilson revised this gist Sep 13, 2016. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion deploying-meteor-apps.md
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,6 @@
    1. [Set up your custom domain](#set-up-your-custom-domain)
    1. [Add some swap space](#add-some-swap-space)
    1. [Set up SSL](#set-up-ssl)
    1. [Set up SSL](#set-up-ssl)
    1. [Ports and Redirects with nginx](#ports-and-redirects-with-nginx)
    1. [Install Meteor Up](#install-meteor-up)
    1. [Visit your domain](#visit-your-domain)
  3. jamiewilson revised this gist Sep 13, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion deploying-meteor-apps.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    #### Table of Contents

    1. [Create an SSH Key](#create-an-sss-key)
    1. [Create an SSH Key](#create-an-ssh-key)
    1. [Create a Digital Ocean account and droplet](#create-a-digital-ocean-account-and-droplet)
    1. [Connect to your server with SSH](#connect-to-your-server-with-ssh)
    1. [Create a new user and disable root access](#create-a-new-user-and-disable-root-access)
  4. jamiewilson revised this gist Sep 15, 2015. 1 changed file with 11 additions and 11 deletions.
    22 changes: 11 additions & 11 deletions deploying-meteor-apps.md
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ You'll then be asked to enter a passphrase. Again, leave it empty and hit enter.

    Enter passphrase (empty for no passphrase):

    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)
    [Back to Top](#deploying-a-meteor-app-to-digital-ocean)

    ### Create a Digital Ocean account and droplet

    @@ -45,7 +45,7 @@ Then, back on Digital Ocean, give the key a name and **paste it into the space**

    ![](http://i.imgur.com/5QX7InA.png)

    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)
    [Back to Top](#deploying-a-meteor-app-to-digital-ocean)

    ### Connect to your server with SSH

    @@ -65,7 +65,7 @@ The following repsonse should be:

    If your connection is closed after this step, just repeat the `ssh [email protected]` step. You are now logged into your server as the root user using an SSH key.

    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)
    [Back to Top](#deploying-a-meteor-app-to-digital-ocean)

    ### Create a new user and disable root access

    @@ -93,7 +93,7 @@ Once you've created and confirmed your new password, you'll be asked a few quest

    You can leave these blank if you don't need this info for your new user.

    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)
    [Back to Top](#deploying-a-meteor-app-to-digital-ocean)

    ### Give your new user [sudo privileges](https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos) and add SSH keys to his/her account

    @@ -147,7 +147,7 @@ Which should give you a prompt like the following to let you know that you are b
    logout
    root@dropletName:~#

    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)
    [Back to Top](#deploying-a-meteor-app-to-digital-ocean)

    ### Disable remote access to `root` account

    @@ -165,7 +165,7 @@ Exit and logout of your server session with:

    exit

    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)
    [Back to Top](#deploying-a-meteor-app-to-digital-ocean)

    ### Test your SSH connection

    @@ -175,7 +175,7 @@ To test your connection with your new username and SSH key, simply execute:

    This should automatically log you on to your server as `username`.

    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)
    [Back to Top](#deploying-a-meteor-app-to-digital-ocean)

    ### Set up your custom domain

    @@ -197,7 +197,7 @@ Now, create a new A record with the name of `@` and your IP address like so:

    ![](http://i.imgur.com/seJkG09.png)

    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)
    [Back to Top](#deploying-a-meteor-app-to-digital-ocean)

    ### Add some swap space
    (Optional) Follow the instructions here: [How to Add Swap](https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04)
    @@ -231,7 +231,7 @@ This will generate a new file for you with a key with no password. Now, you'll n

    Save the `ssl.pem` file for later (or move it to a directory called `mup-your-project-name` somewhere outside your app repo).

    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)
    [Back to Top](#deploying-a-meteor-app-to-digital-ocean)

    ### Ports and Redirects with [nginx](https://en.m.wikipedia.org/wiki/Nginx)

    @@ -299,7 +299,7 @@ To test the change, open a **new terminal window** and run:

    The top line should read `HTTP/1.1 301 Moved Permanently`.

    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)
    [Back to Top](#deploying-a-meteor-app-to-digital-ocean)

    ### Install [Meteor Up](https://github.com/arunoda/meteor-up)

    @@ -369,4 +369,4 @@ If successful, your output should look like:

    That should do it. Your site should be live.

    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)
    [Back to Top](#deploying-a-meteor-app-to-digital-ocean)
  5. jamiewilson revised this gist Sep 15, 2015. 1 changed file with 11 additions and 11 deletions.
    22 changes: 11 additions & 11 deletions deploying-meteor-apps.md
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ You'll then be asked to enter a passphrase. Again, leave it empty and hit enter.

    Enter passphrase (empty for no passphrase):

    [Table of Contents](#table-of-contents)
    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)

    ### Create a Digital Ocean account and droplet

    @@ -45,7 +45,7 @@ Then, back on Digital Ocean, give the key a name and **paste it into the space**

    ![](http://i.imgur.com/5QX7InA.png)

    [Table of Contents](#table-of-contents)
    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)

    ### Connect to your server with SSH

    @@ -65,7 +65,7 @@ The following repsonse should be:

    If your connection is closed after this step, just repeat the `ssh [email protected]` step. You are now logged into your server as the root user using an SSH key.

    [Table of Contents](#table-of-contents)
    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)

    ### Create a new user and disable root access

    @@ -93,7 +93,7 @@ Once you've created and confirmed your new password, you'll be asked a few quest

    You can leave these blank if you don't need this info for your new user.

    [Table of Contents](#table-of-contents)
    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)

    ### Give your new user [sudo privileges](https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos) and add SSH keys to his/her account

    @@ -147,7 +147,7 @@ Which should give you a prompt like the following to let you know that you are b
    logout
    root@dropletName:~#

    [Table of Contents](#table-of-contents)
    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)

    ### Disable remote access to `root` account

    @@ -165,7 +165,7 @@ Exit and logout of your server session with:

    exit

    [Table of Contents](#table-of-contents)
    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)

    ### Test your SSH connection

    @@ -175,7 +175,7 @@ To test your connection with your new username and SSH key, simply execute:

    This should automatically log you on to your server as `username`.

    [Table of Contents](#table-of-contents)
    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)

    ### Set up your custom domain

    @@ -197,7 +197,7 @@ Now, create a new A record with the name of `@` and your IP address like so:

    ![](http://i.imgur.com/seJkG09.png)

    [Table of Contents](#table-of-contents)
    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)

    ### Add some swap space
    (Optional) Follow the instructions here: [How to Add Swap](https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04)
    @@ -231,7 +231,7 @@ This will generate a new file for you with a key with no password. Now, you'll n

    Save the `ssl.pem` file for later (or move it to a directory called `mup-your-project-name` somewhere outside your app repo).

    [Table of Contents](#table-of-contents)
    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)

    ### Ports and Redirects with [nginx](https://en.m.wikipedia.org/wiki/Nginx)

    @@ -299,7 +299,7 @@ To test the change, open a **new terminal window** and run:

    The top line should read `HTTP/1.1 301 Moved Permanently`.

    [Table of Contents](#table-of-contents)
    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)

    ### Install [Meteor Up](https://github.com/arunoda/meteor-up)

    @@ -369,4 +369,4 @@ If successful, your output should look like:

    That should do it. Your site should be live.

    [Table of Contents](#table-of-contents)
    [Back to Top](https://gist.github.com/jamiewilson/4e1d28f9a200cb34ad59)
  6. jamiewilson revised this gist Sep 15, 2015. 1 changed file with 11 additions and 11 deletions.
    22 changes: 11 additions & 11 deletions deploying-meteor-apps.md
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ You'll then be asked to enter a passphrase. Again, leave it empty and hit enter.

    Enter passphrase (empty for no passphrase):

    [Table of Content](#table-of-contents)
    [Table of Contents](#table-of-contents)

    ### Create a Digital Ocean account and droplet

    @@ -45,7 +45,7 @@ Then, back on Digital Ocean, give the key a name and **paste it into the space**

    ![](http://i.imgur.com/5QX7InA.png)

    [Table of Content](#table-of-contents)
    [Table of Contents](#table-of-contents)

    ### Connect to your server with SSH

    @@ -65,7 +65,7 @@ The following repsonse should be:

    If your connection is closed after this step, just repeat the `ssh [email protected]` step. You are now logged into your server as the root user using an SSH key.

    [Table of Content](#table-of-contents)
    [Table of Contents](#table-of-contents)

    ### Create a new user and disable root access

    @@ -93,7 +93,7 @@ Once you've created and confirmed your new password, you'll be asked a few quest

    You can leave these blank if you don't need this info for your new user.

    [Table of Content](#table-of-contents)
    [Table of Contents](#table-of-contents)

    ### Give your new user [sudo privileges](https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos) and add SSH keys to his/her account

    @@ -147,7 +147,7 @@ Which should give you a prompt like the following to let you know that you are b
    logout
    root@dropletName:~#

    [Table of Content](#table-of-contents)
    [Table of Contents](#table-of-contents)

    ### Disable remote access to `root` account

    @@ -165,7 +165,7 @@ Exit and logout of your server session with:

    exit

    [Table of Content](#table-of-contents)
    [Table of Contents](#table-of-contents)

    ### Test your SSH connection

    @@ -175,7 +175,7 @@ To test your connection with your new username and SSH key, simply execute:

    This should automatically log you on to your server as `username`.

    [Table of Content](#table-of-contents)
    [Table of Contents](#table-of-contents)

    ### Set up your custom domain

    @@ -197,7 +197,7 @@ Now, create a new A record with the name of `@` and your IP address like so:

    ![](http://i.imgur.com/seJkG09.png)

    [Table of Content](#table-of-contents)
    [Table of Contents](#table-of-contents)

    ### Add some swap space
    (Optional) Follow the instructions here: [How to Add Swap](https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04)
    @@ -231,7 +231,7 @@ This will generate a new file for you with a key with no password. Now, you'll n

    Save the `ssl.pem` file for later (or move it to a directory called `mup-your-project-name` somewhere outside your app repo).

    [Table of Content](#table-of-contents)
    [Table of Contents](#table-of-contents)

    ### Ports and Redirects with [nginx](https://en.m.wikipedia.org/wiki/Nginx)

    @@ -299,7 +299,7 @@ To test the change, open a **new terminal window** and run:

    The top line should read `HTTP/1.1 301 Moved Permanently`.

    [Table of Content](#table-of-contents)
    [Table of Contents](#table-of-contents)

    ### Install [Meteor Up](https://github.com/arunoda/meteor-up)

    @@ -369,4 +369,4 @@ If successful, your output should look like:

    That should do it. Your site should be live.

    [Table of Content](#table-of-contents)
    [Table of Contents](#table-of-contents)
  7. jamiewilson revised this gist Sep 15, 2015. 1 changed file with 25 additions and 1 deletion.
    26 changes: 25 additions & 1 deletion deploying-meteor-apps.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    #Deploying a Meteor app to Digital Ocean

    #### Table of Contents

    1. [Create an SSH Key](#create-an-sss-key)
    1. [Create a Digital Ocean account and droplet](#create-a-digital-ocean-account-and-droplet)
    1. [Connect to your server with SSH](#connect-to-your-server-with-ssh)
    @@ -29,6 +31,8 @@ You'll then be asked to enter a passphrase. Again, leave it empty and hit enter.

    Enter passphrase (empty for no passphrase):

    [Table of Content](#table-of-contents)

    ### Create a Digital Ocean account and droplet

    Select Ubuntu for your operating system. For production apps, it's recommended that you spring for the $10/month set up. For a full walkthrough, read [How To Create Your First DigitalOcean Droplet Virtual Server](https://www.digitalocean.com/community/tutorials/how-to-create-your-first-digitalocean-droplet-virtual-server).
    @@ -39,7 +43,9 @@ When you get to step to add your SSH key, go back to your terminal, **copy the c

    Then, back on Digital Ocean, give the key a name and **paste it into the space** as shown below:

    ![](http://i.imgur.com/5QX7InA.png)
    ![](http://i.imgur.com/5QX7InA.png)

    [Table of Content](#table-of-contents)

    ### Connect to your server with SSH

    @@ -59,6 +65,8 @@ The following repsonse should be:

    If your connection is closed after this step, just repeat the `ssh [email protected]` step. You are now logged into your server as the root user using an SSH key.

    [Table of Content](#table-of-contents)

    ### Create a new user and disable root access

    At the prompt on your server (should look something like this `root@dropletname:~# `, enter `adduser` followed by the username you want the new user to have.
    @@ -85,6 +93,8 @@ Once you've created and confirmed your new password, you'll be asked a few quest

    You can leave these blank if you don't need this info for your new user.

    [Table of Content](#table-of-contents)

    ### Give your new user [sudo privileges](https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos) and add SSH keys to his/her account

    gpasswd -a username sudo
    @@ -137,6 +147,8 @@ Which should give you a prompt like the following to let you know that you are b
    logout
    root@dropletName:~#

    [Table of Content](#table-of-contents)

    ### Disable remote access to `root` account

    Open the config file with:
    @@ -153,6 +165,8 @@ Exit and logout of your server session with:

    exit

    [Table of Content](#table-of-contents)

    ### Test your SSH connection

    To test your connection with your new username and SSH key, simply execute:
    @@ -161,6 +175,8 @@ To test your connection with your new username and SSH key, simply execute:

    This should automatically log you on to your server as `username`.

    [Table of Content](#table-of-contents)

    ### Set up your custom domain

    Go to **your domain registrar** and update your nameservers to point to
    @@ -181,6 +197,8 @@ Now, create a new A record with the name of `@` and your IP address like so:

    ![](http://i.imgur.com/seJkG09.png)

    [Table of Content](#table-of-contents)

    ### Add some swap space
    (Optional) Follow the instructions here: [How to Add Swap](https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04)

    @@ -213,6 +231,8 @@ This will generate a new file for you with a key with no password. Now, you'll n

    Save the `ssl.pem` file for later (or move it to a directory called `mup-your-project-name` somewhere outside your app repo).

    [Table of Content](#table-of-contents)

    ### Ports and Redirects with [nginx](https://en.m.wikipedia.org/wiki/Nginx)

    **Back on your server**, run the following commands update your packages and install nginx:
    @@ -279,6 +299,8 @@ To test the change, open a **new terminal window** and run:

    The top line should read `HTTP/1.1 301 Moved Permanently`.

    [Table of Content](#table-of-contents)

    ### Install [Meteor Up](https://github.com/arunoda/meteor-up)

    npm install -g mup
    @@ -346,3 +368,5 @@ If successful, your output should look like:
    ### Visit your domain

    That should do it. Your site should be live.

    [Table of Content](#table-of-contents)
  8. jamiewilson revised this gist Sep 15, 2015. 1 changed file with 15 additions and 2 deletions.
    17 changes: 15 additions & 2 deletions deploying-meteor-apps.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,19 @@
    #Deploying a Meteor app to Digital Ocean

    1. [Create an SSH Key](#Create an SSH Key)
    1. [Create an SSH Key](#create-an-sss-key)
    1. [Create a Digital Ocean account and droplet](#create-a-digital-ocean-account-and-droplet)
    1. [Connect to your server with SSH](#connect-to-your-server-with-ssh)
    1. [Create a new user and disable root access](#create-a-new-user-and-disable-root-access)
    1. [Give your new user sudo privileges and add SSH keys to his/her account](#give-your-new-user-sudo-privileges-and-add-ssh-keys-to-hisher-account)
    1. [Disable remote access to root account](#disable-remote-access-to-root-account)
    1. [Test your SSH connection](#test-your-ssh-connection)
    1. [Set up your custom domain](#set-up-your-custom-domain)
    1. [Add some swap space](#add-some-swap-space)
    1. [Set up SSL](#set-up-ssl)
    1. [Set up SSL](#set-up-ssl)
    1. [Ports and Redirects with nginx](#ports-and-redirects-with-nginx)
    1. [Install Meteor Up](#install-meteor-up)
    1. [Visit your domain](#visit-your-domain)

    ### Create an SSH Key

    @@ -266,7 +279,7 @@ To test the change, open a **new terminal window** and run:

    The top line should read `HTTP/1.1 301 Moved Permanently`.

    ### Install [Meteor Up](https://github.com/arunoda/meteor-up) (mup for short)
    ### Install [Meteor Up](https://github.com/arunoda/meteor-up)

    npm install -g mup

  9. jamiewilson revised this gist Sep 15, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions deploying-meteor-apps.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,7 @@
    #Deploying a Meteor app to Digital Ocean

    1. [Create an SSH Key](#Create an SSH Key)

    ### Create an SSH Key

    If you don't already have one, create an RSA key pair. In Terminal enter:
  10. jamiewilson revised this gist Sep 15, 2015. 1 changed file with 46 additions and 16 deletions.
    62 changes: 46 additions & 16 deletions deploying-meteor-apps.md
    Original file line number Diff line number Diff line change
    @@ -37,10 +37,10 @@ You'll likely be prompted with the following question. Answer `yes`.
    The authenticity of host 'XXX.XXX.XX.XXX (XXX.XXX.XX.XXX)' can't be established.
    RSA key fingerprint is Xx:xX:Xx:XX:XX:Xx:XX:XX:XX:xX:XX:XX:Xx:Xx:xx:Xx.
    Are you sure you want to continue connecting (yes/no)?

    The following repsonse should be:

    Warning: Permanently added 'XXX.XXX.XX.XXX' (RSA) to the list of known hosts.
    Warning: Permanently added 'XXX.XXX.XX.XXX' (RSA) to the list of known hosts.

    If your connection is closed after this step, just repeat the `ssh [email protected]` step. You are now logged into your server as the root user using an SSH key.

    @@ -55,13 +55,13 @@ You'll be asked to create a password. What you type will not show up on screen,
    Enter new UNIX password:
    Retype new UNIX password:

    **SAVE YOUR PASSWORD somewhere safe!**
    **SAVE YOUR PASSWORD somewhere safe!**

    Once you've created and confirmed your new password, you'll be asked a few questions:

    Changing the user information for username
    Enter the new value, or press ENTER for the default
    Full Name []:
    Full Name []:
    Room Number []:
    Work Phone []:
    Home Phone []:
    @@ -80,7 +80,7 @@ And you also need to add NOPASSWD to your sudoers file. Open it with:

    Then, replace the line that says `%sudo ALL=(ALL) ALL` with

    %sudo ALL=(ALL) NOPASSWD:ALL
    %sudo ALL=(ALL) NOPASSWD:ALL

    To save these edits, type `Ctrl + X`, then confirm by typing `Y` and hitting enter:

    @@ -148,10 +148,10 @@ This should automatically log you on to your server as `username`.

    ### Set up your custom domain

    Go to **your domain registrar** and update your nameservers to point to
    Go to **your domain registrar** and update your nameservers to point to

    - `ns1.digitalocean.com`
    - `ns2.digitalocean.com`
    - `ns1.digitalocean.com`
    - `ns2.digitalocean.com`
    - `ns3.digitalocean.com`

    This is what the [iwantmyname](https://iwantmyname.com/) settings look like:
    @@ -170,7 +170,33 @@ Now, create a new A record with the name of `@` and your IP address like so:
    (Optional) Follow the instructions here: [How to Add Swap](https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04)

    ### Set up SSL
    (Coming Soon)
    From the prompt on you server, enter the following where `yourserver` is the name of your server:

    openssl req -new -newkey rsa:2048 -nodes -keyout yourserver.key -out yourserver.csr

    This will generate a series of questions. When asked for **Common Name**, make sure you enter a wildcar subdomain for your address `*.yourdomain.com`:

    Common Name (e.g. server FQDN or YOUR name) []: *.yourdomain.com

    Now, print the contents of the new `yourserver.csr` file using:

    cat ~/yourserver.csr

    Copy the output with both the `-----BEGIN CERTIFICATE REQUEST-----` and `-----END CERTIFICATE REQUEST-----` tags. Create new file and save it as `yourdomain.key`.

    Go purchase your wildcard SSL certificate. After purchasing, follow instructions to activate your cert with your `yourserver.csr` key. Be sure to select **nginx** as your web server. Wait for the emails and follow instructions.

    Once you get the zipped file of certs, unzip them and at your `yourdomain.key` file to the folder.

    First, run this command to remove the password you set on you key:

    openssl rsa -in yourdomain.key -out yourdomain.nopass.key

    This will generate a new file for you with a key with no password. Now, you'll need to combine them into one file using a the following command with your file names:

    cat yourdomain.crt DomainValidationSecureServerCA.crt AddTrustCA.crt.crt AddTrustExternalCARoot.crt yourdomain.nopass.key > ssl.pem

    Save the `ssl.pem` file for later (or move it to a directory called `mup-your-project-name` somewhere outside your app repo).

    ### Ports and Redirects with [nginx](https://en.m.wikipedia.org/wiki/Nginx)

    @@ -224,7 +250,7 @@ Save and exit this file. Next, we'll add a small security measure by [hiding our

    sudo nano /etc/nginx/nginx.conf

    Find and **uncomment** the line with
    Find and **uncomment** the line with

    server_tokens off;

    @@ -236,7 +262,7 @@ To test the change, open a **new terminal window** and run:

    curl -I http://www.yourdomain.com

    The top line should read `HTTP/1.1 301 Moved Permanently`.
    The top line should read `HTTP/1.1 301 Moved Permanently`.

    ### Install [Meteor Up](https://github.com/arunoda/meteor-up) (mup for short)

    @@ -253,7 +279,7 @@ This should create two files: `mup.json` and `settings.json`. Open `mup.json` an
    ```js
    // Server authentication info
    "servers": [
    {
    {
    // the domain linked to Digital Ocean
    "host": "yourdomain.com",
    // the new user you created on the server
    @@ -262,6 +288,10 @@ This should create two files: `mup.json` and `settings.json`. Open `mup.json` an
    "pem": "~/.ssh/id_rsa"
    }
    ],

    "ssl": {
    "pem": "./ssl.pem"
    },
    ```

    Then, a bit further down in the same file:
    @@ -277,12 +307,12 @@ Then, a bit further down in the same file:
    "env": {
    "ROOT_URL": "http://yourdomain.com",
    // any port other than 80 (the default)
    // because nginx is running on port 80
    "PORT": 3000
    // because nginx is running on port 80
    "PORT": 3000
    },
    ```

    Now, within your ` ~/mup-your-project-name` directory, setup your server by running
    Now, within your ` ~/mup-your-project-name` directory, setup your server by running

    mup setup

    @@ -300,4 +330,4 @@ If successful, your output should look like:

    ### Visit your domain

    That should do it. Your site should be live.
    That should do it. Your site should be live.
  11. jamiewilson revised this gist Sep 14, 2015. 1 changed file with 67 additions and 121 deletions.
    188 changes: 67 additions & 121 deletions deploying-meteor-apps.md
    Original file line number Diff line number Diff line change
    @@ -4,31 +4,23 @@

    If you don't already have one, create an RSA key pair. In Terminal enter:

    ```ShellSession
    ssh-keygen -t rsa
    ```
    ssh-keygen -t rsa

    It will then ask you to name the file. Leave it empty and hit enter to accept the defualt name, `id_rsa`.

    ```ShellSession
    Enter file in which to save the key (/demo/.ssh/id_rsa):
    ```
    Enter file in which to save the key (/demo/.ssh/id_rsa):

    You'll then be asked to enter a passphrase. Again, leave it empty and hit enter.

    ```ShellSession
    Enter passphrase (empty for no passphrase):
    ```
    Enter passphrase (empty for no passphrase):

    ### Create a Digital Ocean account and droplet

    Select Ubuntu for your operating system. For production apps, it's recommended that you spring for the $10/month set up. For a full walkthrough, read [How To Create Your First DigitalOcean Droplet Virtual Server](https://www.digitalocean.com/community/tutorials/how-to-create-your-first-digitalocean-droplet-virtual-server).

    When you get to step to add your SSH key, go back to your terminal, **copy the contents of your new key** with:

    ```ShellSession
    cat ~/.ssh/id_rsa.pub | pbcopy
    ```
    cat ~/.ssh/id_rsa.pub | pbcopy

    Then, back on Digital Ocean, give the key a name and **paste it into the space** as shown below:

    @@ -38,144 +30,119 @@ Then, back on Digital Ocean, give the key a name and **paste it into the space**

    Copy your IP address from your newly created droplet. **In Terminal**, enter the following with your IP:

    ```ShellSession
    ssh [email protected]
    ```
    ssh [email protected]

    You'll likely be prompted with the following question. Answer `yes`.

    ```ShellSession
    The authenticity of host 'XXX.XXX.XX.XXX (XXX.XXX.XX.XXX)' can't be established.
    RSA key fingerprint is Xx:xX:Xx:XX:XX:Xx:XX:XX:XX:xX:XX:XX:Xx:Xx:xx:Xx.
    Are you sure you want to continue connecting (yes/no)?
    ```
    The authenticity of host 'XXX.XXX.XX.XXX (XXX.XXX.XX.XXX)' can't be established.
    RSA key fingerprint is Xx:xX:Xx:XX:XX:Xx:XX:XX:XX:xX:XX:XX:Xx:Xx:xx:Xx.
    Are you sure you want to continue connecting (yes/no)?

    The following repsonse should be:

    ```ShellSession
    Warning: Permanently added 'XXX.XXX.XX.XXX' (RSA) to the list of known hosts.
    ```
    Warning: Permanently added 'XXX.XXX.XX.XXX' (RSA) to the list of known hosts.

    If your connection is closed after this step, just repeat the `ssh [email protected]` step. You are now logged into your server as the root user using an SSH key.

    ### Create a new user and disable root access

    At the prompt on your server (should look something like this `root@dropletname:~# `, enter `adduser` followed by the username you want the new user to have.

    ```ShellSession
    adduser username
    ```
    adduser username

    You'll be asked to create a password. What you type will not show up on screen, but type your password and hit enter. Then retype and hit enter again:

    ```ShellSession
    Enter new UNIX password:
    Retype new UNIX password:
    ```
    Enter new UNIX password:
    Retype new UNIX password:

    **SAVE YOUR PASSWORD somewhere safe!**

    Once you've created and confirmed your new password, you'll be asked a few questions:

    ```ShellSession
    Changing the user information for username
    Enter the new value, or press ENTER for the default
    Full Name []:
    Room Number []:
    Work Phone []:
    Home Phone []:
    Other []:
    Is the information correct? [Y/n] Y
    ```
    Changing the user information for username
    Enter the new value, or press ENTER for the default
    Full Name []:
    Room Number []:
    Work Phone []:
    Home Phone []:
    Other []:
    Is the information correct? [Y/n] Y

    You can leave these blank if you don't need this info for your new user.

    ### Give your new user [sudo privileges](https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos) and add SSH keys to his/her account

    ```ShellSession
    gpasswd -a username sudo
    ```
    gpasswd -a username sudo

    Switch to your new user with: _The dash before the username makes sure that you actually log in as the new user._
    And you also need to add NOPASSWD to your sudoers file. Open it with:

    ```ShellSession
    su - username
    ```
    sudo visudo

    Then, replace the line that says `%sudo ALL=(ALL) ALL` with

    %sudo ALL=(ALL) NOPASSWD:ALL

    To save these edits, type `Ctrl + X`, then confirm by typing `Y` and hitting enter:

    Now, switch to your new user with: _The dash before the username makes sure that you actually log in as the new user._

    su - username

    Next, create a new folder called `.ssh` and then restrict its permissions with the following commands:

    ```ShellSession
    mkdir .ssh
    chmod 700 .ssh
    ```
    mkdir .ssh
    chmod 700 .ssh

    Using the [nano](http://mintaka.sdsu.edu/reu/nano.html) editor, we can create and edit a new file called `authorized_keys` using the following command:

    ```ShellSession
    nano .ssh/authorized_keys
    ```
    nano .ssh/authorized_keys

    **In another Terminal window or tab**, copy your SSH key again with:

    ```ShellSession
    cat ~/.ssh/id_rsa.pub | pbcopy
    ```
    cat ~/.ssh/id_rsa.pub | pbcopy

    **Back in the nano editor** window on the server, **paste in your key**. You should see your key displayed, without wrapping like so:

    ```
    ssh-rsa MIICXAIBAAKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0FPqri0cb2JZfXJ/DgYSF6vUpwmJG8wVQZKjeGcjDOL5UlsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ51s1SPrCBkedbNf0Tp0GbMJDyR4e9T04ZZwIDAQABAoGAFijko56+qGyN8M0RVyaRAXz++xTqHBLh3tx4VgMtrQ+WEgCjhoTwo23KMBAuJGSYnRmoBZM3lMfTKevIkAidPExvYCdm5dYq3XToLkkLv5L2pIIVOFMDG+KESnAFV7l2c+cnzRMW0+b6f8mR1CJzZuxVLL6Q02fvLi55/mbSYxECQQDeAw6fiIQXGukBI4eMZZt4nscy2o12KyYner3VpoeE+Np2q+Z3pvAMd/aNzQ/W9WaI+NRfcxUJrmfPwIGm63ilAkEAxCL5HQb2bQr4ByorcMWm/hEP2MZzROV73yF41hPsRC9m66KrheO9HPTJuo3/9s5p+sqGxOlFL0NDt4SkosjgGwJAFklyR1uZ/wPJjj611cdBcztlPdqoxssQGnh85BzCj/u3WqBpE2vjvyyvyI5kX6zk7S0ljKtt2jny2+00VsBerQJBAJGC1Mg5Oydo5NwD6BiROrPxGo2bpTbu/fhrT8ebHkTz2eplU9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ37sJ5QsW+sJyoNde3xH8vdXhzU7eT82D6X/scw9RZz+/6rCJ4p0=
    ```
    ssh-rsa MIICXAIBAAKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0FPqri0cb2JZfXJ/DgYSF6vUpwmJG8wVQZKjeGcjDOL5UlsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ51s1SPrCBkedbNf0Tp0GbMJDyR4e9T04ZZwIDAQABAoGAFijko56+qGyN8M0RVyaRAXz++xTqHBLh3tx4VgMtrQ+WEgCjhoTwo23KMBAuJGSYnRmoBZM3lMfTKevIkAidPExvYCdm5dYq3XToLkkLv5L2pIIVOFMDG+KESnAFV7l2c+cnzRMW0+b6f8mR1CJzZuxVLL6Q02fvLi55/mbSYxECQQDeAw6fiIQXGukBI4eMZZt4nscy2o12KyYner3VpoeE+Np2q+Z3pvAMd/aNzQ/W9WaI+NRfcxUJrmfPwIGm63ilAkEAxCL5HQb2bQr4ByorcMWm/hEP2MZzROV73yF41hPsRC9m66KrheO9HPTJuo3/9s5p+sqGxOlFL0NDt4SkosjgGwJAFklyR1uZ/wPJjj611cdBcztlPdqoxssQGnh85BzCj/u3WqBpE2vjvyyvyI5kX6zk7S0ljKtt2jny2+00VsBerQJBAJGC1Mg5Oydo5NwD6BiROrPxGo2bpTbu/fhrT8ebHkTz2eplU9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ37sJ5QsW+sJyoNde3xH8vdXhzU7eT82D6X/scw9RZz+/6rCJ4p0=

    To save these edits, type `Ctrl + X`, then confirm by typing `Y` and hitting enter:

    ```
    Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? Y
    ```
    Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? Y

    Now restrict the permissions of the authorized_keys file with this command:

    ```ShellSession
    chmod 600 .ssh/authorized_keys
    ```
    chmod 600 .ssh/authorized_keys

    Return to the `root` user with:

    ```ShellSession
    exit
    ```
    exit

    Which should give you a prompt like the following to let you know that you are back on the root user:

    ```ShellSession
    logout
    root@dropletName:~#
    ```
    logout
    root@dropletName:~#

    ### Disable remote access to `root` account

    Open the config file with:

    ```
    nano /etc/ssh/sshd_config
    ```
    nano /etc/ssh/sshd_config

    Around 28 lines down this file, change `PermitRootLogin` value to:

    ```XML
    PermitRootLogin no
    ```
    PermitRootLogin no

    Save the file as before with `Ctrl + X`, `y` and `enter`.

    Exit and logout of your server session with:

    ```ShellSession
    exit
    ```
    exit

    ### Test your SSH connection

    To test your connection with your new username and SSH key, simply execute:

    ```ShellSession
    ssh [email protected]
    ```
    ssh [email protected]

    This should automatically log you on to your server as `username`.

    @@ -209,16 +176,12 @@ Now, create a new A record with the name of `@` and your IP address like so:

    **Back on your server**, run the following commands update your packages and install nginx:

    ```ShellSession
    sudo apt-get update
    sudo apt-get install nginx
    ```
    sudo apt-get update
    sudo apt-get install nginx

    Answer yes, when asked if you want to continue. Now open the server block default config file with:

    ```ShellSession
    sudo nano /etc/nginx/sites-enabled/default
    ```
    sudo nano /etc/nginx/sites-enabled/default

    Next, paste the following block into the file and **edit to match your domain name**. You can redirect just the `www` subdomain to you non-www domain with, or use a wildcard:

    @@ -236,9 +199,8 @@ Save the file as before with `Ctrl + X`, `y` and `enter`.

    Now, let's forward our domain to a different port number since nginx is listening on port 80. We'll use port 3000. Create and edit a new file with:

    ```ShellSession
    sudo nano /etc/nginx/sites-enabled/yourappname.com.conf
    ```
    sudo nano /etc/nginx/sites-enabled/yourappname.com.conf

    Then past this block into that file:

    ```Nginx
    @@ -260,43 +222,31 @@ server {

    Save and exit this file. Next, we'll add a small security measure by [hiding our nginx version number](http://www.nginxtips.com/how-to-hide-nginx-version/). Run,

    ```ShellSession
    sudo nano /etc/nginx/nginx.conf
    ```
    sudo nano /etc/nginx/nginx.conf

    Find and **uncomment** the line with

    ```
    server_tokens off;
    ```
    server_tokens off;

    Save and exit this file. Then run:

    ```ShellSession
    sudo service nginx restart
    ```
    sudo service nginx restart

    To test the change, open a **new terminal window** and run:

    ```ShellSession
    curl -I http://www.yourdomain.com
    ```
    curl -I http://www.yourdomain.com

    The top line should read `HTTP/1.1 301 Moved Permanently`.

    ### Install [Meteor Up](https://github.com/arunoda/meteor-up) (mup for short)

    ```ShellSession
    npm install -g mup
    ```
    npm install -g mup

    Now, create a directory called `mup-your-project-name` somewhere outside your app's repo, switch to it, and initialize mup.

    ```ShellSession
    mkdir ~/mup-your-project-name
    cd ~/mup-your-project-name
    mup init
    ```
    mkdir ~/mup-your-project-name
    cd ~/mup-your-project-name
    mup init

    This should create two files: `mup.json` and `settings.json`. Open `mup.json` and under the servers block, put in your details:

    @@ -334,19 +284,15 @@ Then, a bit further down in the same file:

    Now, within your ` ~/mup-your-project-name` directory, setup your server by running

    ```
    mup setup
    ```
    mup setup

    After that's done, it should look something like this ([make your command line look awesome](http://commandlinepoweruser.com/)):

    ![](http://i.imgur.com/kqmQvsT.jpg)

    Then deploy your app with:

    ```ShellSession
    mup deploy
    ```
    mup deploy

    If successful, your output should look like:

  12. jamiewilson revised this gist Sep 14, 2015. 1 changed file with 2 additions and 5 deletions.
    7 changes: 2 additions & 5 deletions deploying-meteor-apps.md
    Original file line number Diff line number Diff line change
    @@ -300,8 +300,7 @@ mup init

    This should create two files: `mup.json` and `settings.json`. Open `mup.json` and under the servers block, put in your details:

    ```json
    {
    ```js
    // Server authentication info
    "servers": [
    {
    @@ -313,13 +312,11 @@ This should create two files: `mup.json` and `settings.json`. Open `mup.json` an
    "pem": "~/.ssh/id_rsa"
    }
    ],
    ...
    }
    ```

    Then, a bit further down in the same file:

    ```json
    ```js
    // Application name (No spaces)
    "appName": "your-project-name",

  13. jamiewilson revised this gist Sep 14, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions deploying-meteor-apps.md
    Original file line number Diff line number Diff line change
    @@ -301,6 +301,7 @@ mup init
    This should create two files: `mup.json` and `settings.json`. Open `mup.json` and under the servers block, put in your details:

    ```json
    {
    // Server authentication info
    "servers": [
    {
    @@ -312,6 +313,8 @@ This should create two files: `mup.json` and `settings.json`. Open `mup.json` an
    "pem": "~/.ssh/id_rsa"
    }
    ],
    ...
    }
    ```

    Then, a bit further down in the same file:
  14. jamiewilson created this gist Sep 14, 2015.
    357 changes: 357 additions & 0 deletions deploying-meteor-apps.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,357 @@
    #Deploying a Meteor app to Digital Ocean

    ### Create an SSH Key

    If you don't already have one, create an RSA key pair. In Terminal enter:

    ```ShellSession
    ssh-keygen -t rsa
    ```

    It will then ask you to name the file. Leave it empty and hit enter to accept the defualt name, `id_rsa`.

    ```ShellSession
    Enter file in which to save the key (/demo/.ssh/id_rsa):
    ```

    You'll then be asked to enter a passphrase. Again, leave it empty and hit enter.

    ```ShellSession
    Enter passphrase (empty for no passphrase):
    ```

    ### Create a Digital Ocean account and droplet

    Select Ubuntu for your operating system. For production apps, it's recommended that you spring for the $10/month set up. For a full walkthrough, read [How To Create Your First DigitalOcean Droplet Virtual Server](https://www.digitalocean.com/community/tutorials/how-to-create-your-first-digitalocean-droplet-virtual-server).

    When you get to step to add your SSH key, go back to your terminal, **copy the contents of your new key** with:

    ```ShellSession
    cat ~/.ssh/id_rsa.pub | pbcopy
    ```

    Then, back on Digital Ocean, give the key a name and **paste it into the space** as shown below:

    ![](http://i.imgur.com/5QX7InA.png)

    ### Connect to your server with SSH

    Copy your IP address from your newly created droplet. **In Terminal**, enter the following with your IP:

    ```ShellSession
    ssh [email protected]
    ```

    You'll likely be prompted with the following question. Answer `yes`.

    ```ShellSession
    The authenticity of host 'XXX.XXX.XX.XXX (XXX.XXX.XX.XXX)' can't be established.
    RSA key fingerprint is Xx:xX:Xx:XX:XX:Xx:XX:XX:XX:xX:XX:XX:Xx:Xx:xx:Xx.
    Are you sure you want to continue connecting (yes/no)?
    ```
    The following repsonse should be:

    ```ShellSession
    Warning: Permanently added 'XXX.XXX.XX.XXX' (RSA) to the list of known hosts.
    ```

    If your connection is closed after this step, just repeat the `ssh [email protected]` step. You are now logged into your server as the root user using an SSH key.

    ### Create a new user and disable root access

    At the prompt on your server (should look something like this `root@dropletname:~# `, enter `adduser` followed by the username you want the new user to have.

    ```ShellSession
    adduser username
    ```

    You'll be asked to create a password. What you type will not show up on screen, but type your password and hit enter. Then retype and hit enter again:

    ```ShellSession
    Enter new UNIX password:
    Retype new UNIX password:
    ```

    **SAVE YOUR PASSWORD somewhere safe!**

    Once you've created and confirmed your new password, you'll be asked a few questions:

    ```ShellSession
    Changing the user information for username
    Enter the new value, or press ENTER for the default
    Full Name []:
    Room Number []:
    Work Phone []:
    Home Phone []:
    Other []:
    Is the information correct? [Y/n] Y
    ```

    You can leave these blank if you don't need this info for your new user.

    ### Give your new user [sudo privileges](https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file-on-ubuntu-and-centos) and add SSH keys to his/her account

    ```ShellSession
    gpasswd -a username sudo
    ```

    Switch to your new user with: _The dash before the username makes sure that you actually log in as the new user._

    ```ShellSession
    su - username
    ```

    Next, create a new folder called `.ssh` and then restrict its permissions with the following commands:

    ```ShellSession
    mkdir .ssh
    chmod 700 .ssh
    ```

    Using the [nano](http://mintaka.sdsu.edu/reu/nano.html) editor, we can create and edit a new file called `authorized_keys` using the following command:

    ```ShellSession
    nano .ssh/authorized_keys
    ```

    **In another Terminal window or tab**, copy your SSH key again with:

    ```ShellSession
    cat ~/.ssh/id_rsa.pub | pbcopy
    ```
    **Back in the nano editor** window on the server, **paste in your key**. You should see your key displayed, without wrapping like so:

    ```
    ssh-rsa MIICXAIBAAKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0FPqri0cb2JZfXJ/DgYSF6vUpwmJG8wVQZKjeGcjDOL5UlsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ51s1SPrCBkedbNf0Tp0GbMJDyR4e9T04ZZwIDAQABAoGAFijko56+qGyN8M0RVyaRAXz++xTqHBLh3tx4VgMtrQ+WEgCjhoTwo23KMBAuJGSYnRmoBZM3lMfTKevIkAidPExvYCdm5dYq3XToLkkLv5L2pIIVOFMDG+KESnAFV7l2c+cnzRMW0+b6f8mR1CJzZuxVLL6Q02fvLi55/mbSYxECQQDeAw6fiIQXGukBI4eMZZt4nscy2o12KyYner3VpoeE+Np2q+Z3pvAMd/aNzQ/W9WaI+NRfcxUJrmfPwIGm63ilAkEAxCL5HQb2bQr4ByorcMWm/hEP2MZzROV73yF41hPsRC9m66KrheO9HPTJuo3/9s5p+sqGxOlFL0NDt4SkosjgGwJAFklyR1uZ/wPJjj611cdBcztlPdqoxssQGnh85BzCj/u3WqBpE2vjvyyvyI5kX6zk7S0ljKtt2jny2+00VsBerQJBAJGC1Mg5Oydo5NwD6BiROrPxGo2bpTbu/fhrT8ebHkTz2eplU9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ37sJ5QsW+sJyoNde3xH8vdXhzU7eT82D6X/scw9RZz+/6rCJ4p0=
    ```

    To save these edits, type `Ctrl + X`, then confirm by typing `Y` and hitting enter:

    ```
    Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? Y
    ```

    Now restrict the permissions of the authorized_keys file with this command:

    ```ShellSession
    chmod 600 .ssh/authorized_keys
    ```
    Return to the `root` user with:

    ```ShellSession
    exit
    ```
    Which should give you a prompt like the following to let you know that you are back on the root user:

    ```ShellSession
    logout
    root@dropletName:~#
    ```

    ### Disable remote access to `root` account

    Open the config file with:

    ```
    nano /etc/ssh/sshd_config
    ```

    Around 28 lines down this file, change `PermitRootLogin` value to:

    ```XML
    PermitRootLogin no
    ```

    Save the file as before with `Ctrl + X`, `y` and `enter`.

    Exit and logout of your server session with:

    ```ShellSession
    exit
    ```
    ### Test your SSH connection

    To test your connection with your new username and SSH key, simply execute:

    ```ShellSession
    ssh [email protected]
    ```

    This should automatically log you on to your server as `username`.

    ### Set up your custom domain

    Go to **your domain registrar** and update your nameservers to point to

    - `ns1.digitalocean.com`
    - `ns2.digitalocean.com`
    - `ns3.digitalocean.com`

    This is what the [iwantmyname](https://iwantmyname.com/) settings look like:

    ![](http://i.imgur.com/WMsY7r9.png)

    **Back on Digital Ocean** add your domain name to your DNS records:

    ![](http://i.imgur.com/XQ7i80o.png)

    Now, create a new A record with the name of `@` and your IP address like so:

    ![](http://i.imgur.com/seJkG09.png)

    ### Add some swap space
    (Optional) Follow the instructions here: [How to Add Swap](https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04)

    ### Set up SSL
    (Coming Soon)

    ### Ports and Redirects with [nginx](https://en.m.wikipedia.org/wiki/Nginx)

    **Back on your server**, run the following commands update your packages and install nginx:

    ```ShellSession
    sudo apt-get update
    sudo apt-get install nginx
    ```

    Answer yes, when asked if you want to continue. Now open the server block default config file with:

    ```ShellSession
    sudo nano /etc/nginx/sites-enabled/default
    ```

    Next, paste the following block into the file and **edit to match your domain name**. You can redirect just the `www` subdomain to you non-www domain with, or use a wildcard:

    ```Nginx
    # redirect www to non-www
    server {
    listen 80;
    # to redirect all subdomains use *.yourdomain.com instead of www.yourdomain.com
    server_name www.yourdomain.com;
    return 301 $scheme://yourdomain.com$request_uri;
    }
    ```

    Save the file as before with `Ctrl + X`, `y` and `enter`.

    Now, let's forward our domain to a different port number since nginx is listening on port 80. We'll use port 3000. Create and edit a new file with:

    ```ShellSession
    sudo nano /etc/nginx/sites-enabled/yourappname.com.conf
    ```
    Then past this block into that file:

    ```Nginx
    server {
    listen 80;
    server_name YOURDOMAIN.com;
    access_log /var/log/nginx/app.dev.access.log;
    error_log /var/log/nginx/app.dev.error.log;
    location / {
    proxy_pass http://XXX.XXX.XX.XXX:3000;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header X-Forwarded-For $remote_addr;
    }
    }
    ```

    Save and exit this file. Next, we'll add a small security measure by [hiding our nginx version number](http://www.nginxtips.com/how-to-hide-nginx-version/). Run,

    ```ShellSession
    sudo nano /etc/nginx/nginx.conf
    ```

    Find and **uncomment** the line with

    ```
    server_tokens off;
    ```

    Save and exit this file. Then run:

    ```ShellSession
    sudo service nginx restart
    ```

    To test the change, open a **new terminal window** and run:

    ```ShellSession
    curl -I http://www.yourdomain.com
    ```

    The top line should read `HTTP/1.1 301 Moved Permanently`.

    ### Install [Meteor Up](https://github.com/arunoda/meteor-up) (mup for short)

    ```ShellSession
    npm install -g mup
    ```

    Now, create a directory called `mup-your-project-name` somewhere outside your app's repo, switch to it, and initialize mup.

    ```ShellSession
    mkdir ~/mup-your-project-name
    cd ~/mup-your-project-name
    mup init
    ```

    This should create two files: `mup.json` and `settings.json`. Open `mup.json` and under the servers block, put in your details:

    ```json
    // Server authentication info
    "servers": [
    {
    // the domain linked to Digital Ocean
    "host": "yourdomain.com",
    // the new user you created on the server
    "username": "username",
    // the SSH key you generated earlier
    "pem": "~/.ssh/id_rsa"
    }
    ],
    ```

    Then, a bit further down in the same file:

    ```json
    // Application name (No spaces)
    "appName": "your-project-name",

    // Location of app (local directory)
    "app": "/path/to/the/app",

    // Configure environment
    "env": {
    "ROOT_URL": "http://yourdomain.com",
    // any port other than 80 (the default)
    // because nginx is running on port 80
    "PORT": 3000
    },
    ```

    Now, within your ` ~/mup-your-project-name` directory, setup your server by running

    ```
    mup setup
    ```

    After that's done, it should look something like this ([make your command line look awesome](http://commandlinepoweruser.com/)):

    ![](http://i.imgur.com/kqmQvsT.jpg)

    Then deploy your app with:

    ```ShellSession
    mup deploy
    ```

    If successful, your output should look like:

    ![](http://i.imgur.com/4G7N7JC.jpg)

    ### Visit your domain

    That should do it. Your site should be live.