Blog

Apache :HTTP Server Port modification

Tags: csfHTTPportwebserver

Published on: July 16, 2014 by Sharafuddin M.A

Apache :HTTP Server Port modification

Scenario:

Apache Port Change:

We all know that the default Port number of Apache is 80. For more security purpose we will be forced for Apache port change, Please see below mentioned steps inorder to change the port number.Assume you need  to change the port number of httpd from  80 to 8080 and for https from 443 to 1023

Search the httpd configuration file 

#vi /usr/local/apache/conf/httpd.conf 

For changing httpd port

Find this line- Listen 80 in the configuration file.

Listen 0.0.0.0:80

Change it to

Listen 0.0.0.0:8080 



Now save the edited file.

For changing https port

Find this line- Listen 443 in the configuration file. 

Listen 0.0.0.0:443

Replace the following line by Listen 0.0.0.0:1023

Listen 0.0.0.0:1023

Now save the edited file.

Finally restart the Apache service.

#/etc/init.d/httpd restart

he Port has been changed successfully.

 

Now you  need to open those ports in firewall. Inorder to open the ports follow below mentioned steps.

# Allow incoming TCP ports

TCP_IN = “20,21,22,25,53,8080,110,143,1023,465,587,993,995,2077,2078,2082,2083,2086,2087,2095,2096,23220,287,3306″

# Allow outgoing TCP ports

TCP_OUT = “20,21,22,25,37,43,53,8080,110,113,1023,587,873,2087,2089,2703,3306″

And Restart the CSF

#/etc/init.d/csf restart

Apache port change working correctly or not ?

Follow the steps to check the modifications are working correctly or not.

For example consider the IP 67.228.194.218

#telnet 67.228.194.218 8080
Trying 67.228.194.218…
Connected to 67.228.194.218.
Escape character is ‘^]’.
^]
telnet> q
Connection closed.

#telnet 67.228.194.218 1023
Trying 67.228.194.218…
Connected to 67.228.194.218.
Escape character is ‘^]’.
^]
telnet> q
Connection closed.

If the telnet is connected to the server, we can confirm that the port has been changed successfully.

Category : Apache, Howtos, Linux

Sharafuddin M.A

Sharafuddin M.A

Sharaf got immense interest and knowledge in implementing custom application and security solutions. He is highly competent in identifying and resolving security vulnerabilities, security breaches, hacked server recovery and server hardening. This soft spoken guy loves to watch movies and hanging out with friends.

You may also read:

Comments

Add new commentSIGN IN

Let's Connect

Categories

Your Cart

Cart is empty.

Subtotal
₹0.00
APPLY
0
Send this to a friend