Step-by-Step Guide: Stopping Nginx on Port 80 for CasaOS Users

If you’re running CasaOS on port 81 and need to free up port 80, which is currently being used by Nginx, this guide is for you. We’ll walk through the process of stopping and completely removing Nginx from your Debian-based system.

Step-by-Step Guide:

  1. Check if Nginx is Using Port 80
  • Purpose: To confirm that Nginx is running on port 80.
  • Instructions: Run the following command in your terminal:
sudo netstat -tulpn | grep :80

If Nginx is using port 80, it will appear in the output.
2. Stop the Nginx Service

  • Purpose: To safely halt the running Nginx service.
  • Instructions: Execute the command:
sudo systemctl stop nginx

This command stops the Nginx service.
3. Disable Nginx from Auto-starting

  • Purpose: To prevent Nginx from starting automatically during system boot.
  • Instructions: Use the following command:
sudo systemctl disable nginx

This will disable Nginx from auto-starting.
4. Uninstall Nginx

  • Purpose: To completely remove Nginx from your system.
  • Instructions: Enter this command:
sudo apt-get remove nginx

This will uninstall Nginx from your Debian-based system.
5. Confirm Port 80 is No Longer Used by Nginx

  • Purpose: To verify that port 80 is free.
  • Instructions: Run the netstat command again:
sudo netstat -tulpn | grep :80

Port 80 should no longer show Nginx in its output.
6. Reboot Your System (Optional)

  • Purpose: To ensure all changes are applied.
  • Instructions: Simply execute:
sudo reboot

This step is optional but can help to make sure all services are running with the new configuration.

  1. Change CasaOS port

You have successfully stopped and removed Nginx from port 80 on your Debian-based system, making way for CasaOS on port 80. These steps are crucial for effective server management and optimizing your system’s performance.