ubuntu Nginx enable and disable vhost file — April 30, 2018

ubuntu Nginx enable and disable vhost file

Enable a vhost file:- We can do this by creating symbolic links from these files to the sites-enabled directory, which Nginx reads from during startup.
We can create these links by typing:

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/

and restart nginx.

Disable a vhost file:-remove example.com file from /etc/nginx/sites-enabled/

and restart nginx.

Before restarting nginx you can always check if the configuration files has any error in it, You can do it with this command.

sudo nginx -t

For better explanation read this link.

Ubuntu command to empty file —
Ubuntu SSH timeout — April 16, 2018
Ubuntu Remove a package and its dependencies — March 26, 2018
Ubuntu apache get list of Virtual hosts — March 12, 2018
LINUX use grep to find content in any file — February 3, 2018
Ubuntu IPTABLE useful commands — February 2, 2018

Ubuntu IPTABLE useful commands

List all rules
sudo iptables -L --line-numbers

Above command will list all rules with (num) in first column for each rule.

Now we can delete them by num
sudo iptables -D INPUT (num)

Super awesome example is here.

To block an IP 
sudo iptables -A INPUT -s xxx.xxx.xxx.xxx -j DROP

xxx.xxx.xxx.xxx is any IP address