This project is part of Full Stack Nanodegree
Julio Cesar Oliveira da Silva
The proposal of this project is the installation of a Linux distribution on a virtual machine and prepare it to host your web application.
IP privado: ( is not required here. ) IP público: 18.191.212.149
Porta ssh: 2200
- sudo adduser grader
- type in grader ALL=(ALL:ALL) ALL, save and quit
- ssh-keygen in local machine for generate keys
- deploy public key on developement enviroment
On virtual machine follow commands below:
$ su - grader $ mkdir .ssh $ touch .ssh/authorized_keys $ vim .ssh/authorized_keys Copy the public key generated on your local machine to this file and save
$ chmod 700 .ssh $ chmod 644 .ssh/authorized_keys
- ssh restart for reload SSH
- sudo apt-get update
- sudo apt-get upgrade
- Use sudo nano /etc/ssh/sshd_config and then change Port 22 to Port 2200
- save & quit. ( ctrl+x + yes + enter)
- Reload SSH using sudo service ssh restart
- sudo ufw default allow outgoing
- sudo ufw default deny incoming
- sudo ufw allow 2200/tcp
- sudo ufw allow 80/tcp
- sudo ufw allow 123/udp
- sudo ufw enable
Configure the time zone sudo dpkg-reconfigure tzdata
- Install Apache sudo apt-get install apache2
- Install mod_wsgi sudo apt-get install python-setuptools libapache2-mod-wsgi
- Restart Apache sudo service apache2 restart
- sudo apt-get install postgresql
- login with: sudo su - postgres
- create a new database
- set a password
- give permission and privileges for new database
- quit qith: postgres=# \q
- exit
- Install git, clone and setup your Catalog App project
- Use cd /var/www to move to the /var/www directory
- sudo mkdir AppOwn
- cd AppOwn
- Clone the Catalog App to the virtual machine with git clone command
-
Create AppOwn.conf to edit: sudo nano /etc/apache2/sites-available/AppOwn.conf
-
Add the following lines of code to the file to configure the virtual host.
<VirtualHost *:80>
ServerName 18.191.212.149
ServerAdmin [email protected]
WSGIScriptAlias / /var/www/AppOwn/appown.wsgi
<Directory /var/www/AppOwn/AppOwn/>
Order allow,deny
Allow from all
Alias /static /var/www/AppOwn/AppOwn/static
<Directory /var/www/AppOwn/AppOwn/static/>
Order allow,deny
Allow from all
ErrorLog
- Enable with: sudo a2ensite AppOwn
- Create the .wsgi Fil with commands:
1.1 cd /var/www/AppOwn 1.2 sudo nano appown.wsgi
- Add the following lines of code to the appown.wsgi file:
#!/usr/bin/python import sys import logging logging.basicConfig(stream=sys.stderr) sys.path.insert(0,"/var/www/AppOwn/")
from AppOwn import app as application application.secret_key = 'secret key'
sudo service apache2 restart
Udacity course: Configuring Linux Web Servers https://br.udacity.com/course/configuring-linux-web-servers--ud299