Public IP: 18.216.120.52 SSH Port: 2200
This is incomplete. I thought it would show up here: http://18.216.120.52/, but I keep getting an error. I've worked on this for some time and am hoping you might be able to help me a little bit with it.
- Used Amazon Lightsail to get a server going.
- SSH'd into the server on my local machine.
- Created a new user 'ryan', and another user 'grader'.
- Used local ssh-keygen to create keys for both accounts. Added them to their own .ssh folders. Basically, I followed the steps 1-6 from here: https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-16-04.
- Updated packages using
sudo apt-get update
followed bysudo apt-get upgrade
. - Set up firewall using the following commands:
sudo ufw default deny incoming sudo ufw default allow outgoing sudo ufw allow ssh sudo ufw allow 2200/tcp (Note: Changed SSH above to port 2200) sudo ufw allow www sudo ufw allow 123/udp sudo ufw enable
- Configured timezone using:
dpkg-reconfigure tzdata
- Installed Apache2:
sudo apt-get install apache2
- Installed Python mod_wsgi:
sudo apt-get install libapache2-mod-wsgi
- Here, I created an example wsgi file and ran a simple "Hello World" app to confirm that Apache2 and wsgi were working properly. This worked, they were working.
- Installed Postgres and created a new DB.
- The user is "postgres". Password in my notes to you.
- Installed Git and copied over my backend-final (catalog) project.
- Added .htaccess file at root of project directory with
RedirectMatch 404 /\.git
- Installed Pip and Virtual Environment:
sudo apt-get install python-pip sudo pip install virtualenv
- Installed all requirements using:
pip install -r requirements.txt
- Tested that the app was running by going to directory for catalog and running
python __init__.py
- running properly. - Configured virtual host in Apache2:
sudo nano /etc/apache2/sites-available/catalog.conf
- Enabled virtual host:
sudo a2ensite catalog
- Created and configured the WSGI file in the top of the catalog directory:
catalog.wsgi
- Replaced sqlite references with postgresql:
engine = create_engine('postgresql://catalog:catalog@localhost/catalog')
- Added Lightsail server IP to hosts file:
sudo nano /etc/hosts
- Removed 000-default.conf file from Apache2
- Restarted Apache:
sudo service apache2 restart
- Restarted Python app:
sudo python __init__.py
https://www.digitalocean.com/community/tutorials/how-to-deploy-a-flask-application-on-an-ubuntu-vps https://stackoverflow.com/questions/6142437/make-git-directory-web-inaccessible https://www.knownhost.com/wiki/security/misc/how-can-i-change-my-ssh-port https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-16-04 https://www.digitalocean.com/community/tutorials/how-to-add-and-delete-users-on-an-ubuntu-14-04-vps https://help.ubuntu.com/lts/serverguide/firewall.html
Ryan Meyers