Hello linux lover in this tutorial i will show you how we can install nginx in linux server. Do you know what is Nginx? Nginx is a Fast, Open Source, a high-performance web server that commands a huge market share in production environments.
Nginx is one of the most popular web servers in the world and hosts some of the largest and highest-traffic sites on the internet. Nginx provides a content management cache, and a reverse proxy feature for HTTP and non-HTTP servers.
Let's follow below command to install nginx in your linux distros. Updating the local package with apt command. Open a terminal window and run the following command:
sudo apt update
Upgrading the local package with apt command. Open a terminal window and run the following command:
sudo apt upgarde
Nginx is available in the Ubuntu 20.04 default repositories and you can install it in your any linux distros by the following command. Run the following command and install Nginx:
sudo apt install nginx
Check Nginx installed correctly, checking by the software version.
nginx -v
Now that you have your web server up and running, let's go over basic management commands. To stop your web server, run this command:
sudo systemctl stop nginx
To start your web server, run this command:
sudo systemctl start nginx
To reload your web server, run this command:
sudo systemctl reload nginx
To disable your web server, run this command:
sudo systemctl disable nginx
To enable your web server, run this command:
sudo systemctl enable nginx
To status your web server, run this command:
sudo systemctl status nginx
Check the available ufw
application profiles:
sudo ufw app list
Let’s enable the most restrictive profile that will still allow the traffic you’ve configured, permitting traffic on port 80
:
sudo ufw allow 'Nginx Full'
Verify the change:
sudo ufw status
If you have other applications or services to allow, make sure you configure your firewall to allow traffic. For example, using the sudo ufw allow 'OpenSSH'
the command will enable secure, encrypted logins over the network.
#linux #nginx