NGINX is the go-to web server for many developersโwhether you need to serve web pages, act as a reverse proxy, or handle load balancing. Itโs fast, reliable, and gets the job done without breaking a sweat. But before NGINX can work its magic, we need to get it installed. Letโs go through the steps of setting it up on your Ubuntu system.
Letโs dive in!
1. Update Your System First (Always! ๐)
We all know that updating is the developer's equivalent of stretching before a run. Before installing NGINX, make sure your system is up to date. Open your terminal and run:
sudo apt update
sudo apt upgrade
This ensures youโre installing everything fresh and avoiding any version clashes.
2. Installing NGINX Like a Pro ๐ป
With the system updated, itโs time to install NGINX! Lucky for us, NGINX is in Ubuntuโs package manager. Just one simple command:
sudo apt install nginx
Thatโs it! NGINX is now on your system, ready to serve content and handle your web requests.
3. Start and Enable NGINX ๐
After installation, letโs get NGINX running:
sudo systemctl start nginx
Want NGINX to start automatically after every reboot? Letโs enable it too:
sudo systemctl enable nginx
With these commands, NGINX will stay running even after your server rebootsโsuper handy for a web server!
4. Check if NGINX is Running Smoothly โ
You might want to check if NGINX is working fine. To verify its status, run:
sudo systemctl status nginx
You should see something like active (running) in green, which means everything is A-OK!
5. Firewall Settings (Optional but Wise) ๐ฅ
If you have a firewall running (and you should!), make sure it allows web traffic. For HTTP (port 80), use:
sudo ufw allow 'Nginx HTTP'
To allow both HTTP and HTTPS (ports 80 and 443):
sudo ufw allow 'Nginx Full'
This will let NGINX do its thing without getting blocked by your firewall.
6. Test It! (The Fun Part) ๐
The final step is to see NGINX in action. Open your browser and type in your server's IP address:
http://your_server_ip
You should see the default NGINX welcome page, confirming that your web server is up and running!
Conclusion:
Boom! ๐ NGINX is now up and running on your Ubuntu system. Whether you're building a simple static site or setting up a complex reverse proxy, you've got a powerful tool at your fingertips.
Thanks for reading, If you liked the post please share it and leave suggestions.
Connect With Me
Website: Hardik Gohil
Github: https://github.com/HardikGohilHLR
Linkedin: https://www.linkedin.com/in/hardikgohilhlr
Thanks โค๏ธ
Top comments (0)