How to change default apache2 listening port 80

Change Listen 80 to your desired port xxx

sudo nano /etc/apache2/ports.conf

#Listen 80

Listen 8888

 

Make sure your VirtualHost also listens on your desired port xxx

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

From port 80 to xxxx

<VirtualHost *:80>

<VirtualHost *:8888>

 

Now restart apache2 service

sudo service apache2 restart

 

Verify listening ports

netstat --listen
netstat -l

Leave a Reply

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

Scroll to top