This quick tips will show you how to change the Apache webserver default port on Ubuntu. On this tutorial, I am using Ubuntu 16.04 server edition. As you know, the Apache default port is 80. For security or any other reasons, we can easily change this number to something else which is not easy to guess by unwanted people out there.
What we need
- Apache web server is installed on Ubuntu. Read how to install LAMP on Ubuntu.
- root access to Ubuntu Server
- little knowledge of Terminal commands
Steps to change Apache Web Server Default port
You can either use the Terminal console on the Server directly or connect from other computer via SSH. And then follow these steps.
We are going to edit the following file : /etc/apache2/ports.conf
sudo nano /etc/apache2/ports.conf
Now you should see the following line on the file:
Change it to port number you like such as
Now save and exit (Ctrl X)
sudo systemctl restart apache2
Now from other computer test the new port