How to set a personalized port as default in Apache?

Solution 1:

To make the server accept connections on both port 44400, on all interfaces, use:

Listen 44400

To make the server accept connections on port 44400 for one interface, use

Listen domain.com:44400

Open your apache2.conf file. To do so, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

sudo gedit /etc/apache2/apache2.conf

Setup Listen as follows:

Listen 44400

Save and close the file. Restart the apache:

sudo /etc/init.d/apache2 restart

Verify that Apache listing:

sudo netstat -tulpn | grep :44400

Solution 2:

In /etc/apache2/ports.conf, change the port as

Listen 44400

Then go to /etc/apache2/sites-enabled/000-default.conf

And change the first line as

<VirtualHost *:44000>

Now restart

sudo service apache2 restart

Apache will now listen on port 44000 and redirect to /var/www/html

Solution 3:

I'm using Ubuntu 14.04. In order to change apache2 default port, change it in /etc/apache2/ports.conf file as;

Listen 44400 

Note:

Adding Listem 44400 in /etc/apache2/apache2.conf file,then apache will listen on 80 and 44400 both ports.