Nginx sites-available & sites-enabled

Folder structure after installation
Create folders
nano /usr/local/etc/nginx/nginx.conf
vim /usr/local/etc/nginx/nginx.conf
subl /usr/local/etc/nginx/nginx.conf
Add the 11th line
include /usr/local/etc/nginx/sites-enabled/*.*;

Sites-available

server {
listen 80;
server_name localhost;

#access_log logs/host.access.log main;

location / {
root html;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 80;
server_name test.loc;

#access_log logs/host.access.log main;

location / {
root /tmp;
index index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
cd /tmp && touch index.html
nano index.html
Simple H1 Test1
Sites available is ready

Sites-enabled

ln -s /usr/local/etc/nginx/sites-available/default.conf /usr/local/etc/nginx/sites-enabledln -s /usr/local/etc/nginx/sites-available/test.loc /usr/local/etc/nginx/sites-enabled
Sites enables

Reload nginx

sudo nginx -s stop && sudo nginx
sudo nginx

Change our hosts /etc/hosts

sudo nano /etc/hosts

Test it

Our site is available now

What next?

Thank you for your attention

Senior web developer, architect, cryptocurrencies trader, https://lytvynov-anton.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store