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

Introduction:

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

Step-by-Step Guide:

  1. Check if Apache is Using Port 80
  • Purpose: To confirm that Apache is running on port 80.

  • Instructions: Run the following command in your terminal:


sudo netstat -tulpn | grep :80

If Apache is using port 80, it will appear in the output.

  1. Stop the Apache Service
  • Purpose: To safely halt the running Apache service.

  • Instructions: Execute the command:


sudo systemctl stop apache2

This command stops the Apache service.

  1. Disable Apache from Auto-starting
  • Purpose: To prevent Apache from starting automatically during system boot.

  • Instructions: Use the following command:


sudo systemctl disable apache2

This will disable Apache from auto-starting.

  1. Uninstall Apache
  • Purpose: To completely remove Apache from your system.

  • Instructions: Enter this command:


sudo apt-get remove apache2

This will uninstall Apache from your Debian-based system.

  1. Confirm Port 80 is No Longer Used by Apache
  • 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 Apache in its output.

  1. 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

Conclusion:

You have successfully stopped and removed Apache 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.