Configure apache to listen on port other than 80

This can be useful when your ISP is blocking standard HTTP port (port 80) so you can bypass that by setting some custom port.

To install apache server, go to Install LAMP article


 

First, we need to change ports.conf

Start your terminal and type:

nano /etc/apache2/ports.conf

Note: You’ll need root or sudo permissions to edit this file

Find line where it says:

Listen 80

and replace that with custom port (I’ll use port 8000 in this tutorial):

Listen 8000

After that, you need to edit 000-default.conf

nano /etc/apache2/sites-enabled/000-default.conf

Change the first line:

<VirtualHost *: 80>

into:

<VirtualHost *: 8000>

You need to restart apache server to apply changes:

service apache2 restart

Now, your apache is running on port 8000 and it can be accessed on address:

http://localhost:8000

Leave a Reply

Your email address will not be published. Required fields are marked *