Self Hosting with EC2 and Nginx

These instructions make the following assumptions:

  • You've just finished using the AWS web console to launch an EC2 server with a 64 bit version of Amazon Linux AMI with at least 1 GB of memory.

  • You've configured your security groups to allow for incoming SSH connections from your local IP.

  • You've configured a domain name (or subdomain) to point to your server's IP address.

Note: You can skip most of these steps by using our public AMI. See the following guide for more details: Deploying a Standard File server on AWS with a pre configured image

Getting started

  1. SSH into your new server with the keys you should have received after launching an instance:

    ssh -i /path/to/key.pem
  2. Update your system:

    sudo yum update
  3. Install RVM (Ruby Version Manager):

    gpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
    \curl -sSL | bash -s stable
  4. Begin using RVM in current session:

    source /home/ec2-user/.rvm/scripts/rvm
  5. Install Ruby

    rvm install ruby

    This should install the latest version of ruby (2.3 at the time of this writing.)

    Note that at least Ruby 2.2.2 is required for Rails 5.

  6. Use Ruby

    rvm use ruby
  7. Install Bundler:

    gem install bundler --no-ri --no-rdoc
  8. Install MySQL (optional; you can also use a hosted db through Amazon RDS, which is recommended):

    sudo yum install mysql56-server
    sudo service mysqld start
    sudo mysql_secure_installation
    sudo yum install mysql-devel
    sudo chkconfig mysqld on

    Create a database:

    mysql -u root -p
    > create database standard_file;
    > quit;
  9. Install Passenger:

    sudo yum install rubygems
    gem install rubygems-update --no-rdoc --no-ri
    gem install passenger --no-rdoc --no-ri
  10. Remove system Nginx installation if installed (you'll use Passenger's instead):

    sudo yum remove nginx
    sudo rm -rf /etc/nginx
  11. Configure Passenger:

    sudo chmod o+x "/home/ec2-user"
    sudo yum install libcurl-devel
    rvmsudo passenger-install-nginx-module
    rvmsudo passenger-config validate-install
  12. Install Git:

    sudo yum install git
  13. Set up HTTPS/SSL for your server (free using LetsEncrypt) (required if using the secure client on

    sudo chown ec2-user /opt
    cd /opt
    git clone
    cd letsencrypt

    Run the setup wizard:

    ./letsencrypt-auto certonly --standalone --debug

    Note the location of the certificates, typically /etc/letsencrypt/live/

  14. Configure Nginx:

    sudo vim /opt/nginx/conf/nginx.conf

    Add this to the bottom of the file, inside the last curly brace:

    server {
        listen 443 ssl default_server;
        ssl_certificate /etc/letsencrypt/live/;
        ssl_certificate_key /etc/letsencrypt/live/;
        passenger_enabled on;
        passenger_app_env production;
        root /home/ec2-user/ruby-server/public;
  15. Make sure you are in your home directory and clone the Standard File ruby-server project:

    cd ~
    git clone
    cd ruby-server
  16. Setup project:

    bundle install
    bower install
    rails assets:precompile
  17. Create a .env file for your environment variables. The Rails app will automatically load these when it starts.

    vim .env


    SECRET_KEY_BASE=use "bundle exec rake secret"
  18. Setup database:

    rails db:migrate
  19. Start Nginx:

    sudo /opt/nginx/sbin/nginx

    Tip: you will need to restart Nginx whenever you make changes to your environment variables or the Nginx configuration:

    sudo /opt/nginx/sbin/nginx -s reload
  20. You're done!

Using your new server

You can immediately start using your new server by using the Standard Notes app at

In the Account menu, enter the address of your new server in "Sync Server Domain" under "Advanced Options".

Then, register for a new account, and begin using your private new secure Standard File server!