Last week I discovered a server with HTTPS port 80 already occupied by other software. Unsurprisingly, another web server program, IIS, was the culprit. Since IIS users are already used to the default port, the Apache installation was left with no choice but to use the less popular HTTP port, in this case port 81.
Why is port 80 important for http, you might ask? Well, first of all is the ease of use for users. If you are viewing a web server listening on a port other than port 80, you will need to include the port number along with the address.
Something like this: http://yourdomain.com:81/ if port 81 is your webserver port. If you are using port 80, you do not need to enter port 80 in the address, as this is the standard port used for HTTP. According to http://www.tcpipguide.com
“To avoid chaos, software that implements a specific server process typically uses the same reserved port number on every IP device, so clients can easily find it Every web browser just“ knows â€that the web sites are designed to listen for requests sent on port 80 “.
So with this fact established, let’s see how we can change the port of our Apache installation. First find the httpd.conf file in your Apache conf folder.
– /
httpd.conf is a text file used by all Apache implementations, so modifying your Unix Apache or Windows Apache installation is done the same way – via this config file. Open the file with your favorite text editor and find the line that says “Listen 80”:
This line tells Apache to listen on port 80. All you have to do is change this port 80 to whatever port you want to use. Make sure the port you will be using is free and not yet occupied by other services. Read our guide on a free port scanner if you’re not sure.
After editing the file, save it and restart Apache. To check if you are already using the new port, look at the URL with the port you used. For example, if you entered port 81 as the new port, the new URL should be http: // yourdomain: 81.
Another method I read about on the internet is slightly different. If the above doesn’t work for you, try going to /etc/apache2/ports.conf and changing the Listen line there to something like Listen 81.
Then go to /etc/apache2/sites-enabled/000-default.conf and change the first line to VirtualHost *: 81. Restart Apache and you can visit the domain without entering the port number. Apache should automatically redirect to / var / www / html. Enjoy!
–