In this article, learn how to install nginx, and basically introduce the usage of nginx.
As a example, using Ubuntu 22.04 LTS
1. Installing Nginx on sever
On terminal, execute:
1 | apt install nginx |
It will automatically install the nginx for you, now execute:
1 | nginx |
which will run the nginx for you, you could visit your server IP address which supposed to have a welcome page of nginx if everything goes well.
If nothing there, please check your firewall configuration. In Ubuntu, please execute the following command to check the firewall status:
1 | ufw status |
2. Configuration Nginx
All nginx stuff will be install on /etc/nginx, and the configuration is at nginx.config, you could whether using vim or any you preferred editor to edit that file.
1 | worker_processes auto; |
3. Related Commands
1 | nginx -s stop # Stop nginx |