How to change the Port Apache HTTPD on VPS Centos 6, 7


As I’ve delivered it earlier in my post on how to change the port apache on Debian or Ubuntu VPS that sometimes we as a provider of the VPS should replace the httpd apache port to another port due to an application that must run on port 80 for example nginx or ssh. In linux VPS, usually httpd.conf is the default application that already can be used without the need to install it manually first.


Because apache httpd applications is already available by default, so if you don’t need it you please just remove or you stop just because this thing will certainly be able to┬áMinimalized the use of RAM your VPS.

But if you still need it but just want to change port only, please follow the steps below:

  • Please log in to your VPS using SSH client such as putty.
  • Change the default port that apache is set in/etc/httpd/conf/httpd.conf by using an ordinary editor you use. I was using the nano editor:

# nano /etc/httpd/conf/httpd.conf

Find the following line:

Listen 80

  • Change numbers 80 to any number you want. Because here I want to change port 80 to port 81 then I replace the number 80 being 81.
  • If you want your apache httpd running on more than one port please add the port number and listen as you want. Example you want to run your httpd running on port 80 and 81, then the settings are as follows:

Listen 80

Listen 81

The last step please restart apache httpd service you with the command:

# nano /etc/init.d/httpd restart

The steps above you can It should be in all Os centos Linux, whether using Centos 5, 6 or 7. To access the next page of a site that has already revamped its port httpd, you need to add:p ort behind IP or domain you have. For example, if you change the last port 80 to port 81, then when you want to access the pages of your site, you have to type in your browser.

If you want to stop your httpd service, please do via the command:

# service httpd stop

If you want to uninstall your httpd, please do it with command:If you want to uninstall your httpd, please do it with command:

# yum remove httpd



This site uses Akismet to reduce spam. Learn how your comment data is processed.