How to install Nginx on Ubuntu: Quick Read
Installing Nginx on Ubuntu is a pretty straightforward process. You can either install it through the Ubuntu repositories or by compiling it from the source. If you want to install Nginx through the Ubuntu repositories,
all you need to do is run the following command:
sudo apt-get install nginx
Once Nginx is installed, you can start it by running the following command:
sudo service nginx start
Now that Nginx is up and running, you’ll probably want to adjust the firewall to allow traffic to nginx. You can do this by running the following command:
sudo ufw allow ‘Nginx HTTP’
Finally, you’ll need to edit the Nginx configuration file to tell it which domain name or IP address to respond to.
The configuration file is located at /etc/nginx/sites-available/default.
If you want Nginx to respond to requests for your domain name, you’ll need to edit the server_name directive.
For example, if your domain name is example.com, you’ll need to change the server_name directive to server_name example.com;. If you want Nginx to respond to requests for a specific IP address, you’ll need to edit the listen directive.
For example, if you want Nginx to respond to requests for the IP address 18.104.22.168, you’ll need to change the listen directive to listen 22.214.171.124:80;.
Once you’ve made your changes, you’ll need to restart Nginx for the changes to take effect.
You can do this by running the following command:
sudo service nginx restart
Now that Nginx is installed and configured, you can start using it to serve web pages.