How to change Apache default port on Ubuntu 16.04

November 28, 2016 | By | Reply More

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.

apache-default-port

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

Now you should see the following line on the file:

Listed 80

Change it to port number you like such as

Listen 82

Now save and exit (Ctrl X)

Restart Apache

Now from other computer test the new port

change-apache-port

Category: Server, Ubuntu

Leave a Reply