Installing Nginx
- sudo apt update
- sudo apt install nginx
After installing it, you already have everything you need.
Creating our own website
Default page is placed in /var/www/html/ location. You can place your static pages here, or use virtual host and place it other location.
Configure
- ssh -i "camo.pem" [email protected]
- cd /etc/nginx/sites-enabled
- sudo vim camo
- sudo vim default
server {
listen 80;
listen [::]:80;
server_name example.ubuntu.com;
root /var/www/;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
- root is a directory where we have placed our .html file.
- index is used to specify file available when visiting root directory of site.
- server_name can be anything you want
Activating virtual host and testing results
sudo service nginx restart