Skip to main content


Showing posts from February 23, 2019

Nginx - Host a static website

Greetings! Let's play with nginx and serve a static website. ;) Step 1: Install nginx sudo apt install nginx Step 2: Update hosts file to add our site name sudo vim /etc/hosts Step 3: Unlink default site cd /etc/nginx/sites-enabled sudo unlink default Step 4: Create folder for the site cd /var/www sudo mkdir sudo chmod o+w touch echo "coming soon" > Step 5: Configure nginx Now we need to nginx where to find our site. sites-available - contains configurations for available sites sites-enabled - contains links to configurations in sites-available. Nginx uses this location to read and run. sudo vim /etc/nginx/sites-available/ server { listen 80 default_server; listen [::]:80 default_server; root /var/www/; index index.html; server_name www.ngin