Change HTTPD port number


We all know that the default Port number of Apache is 80. For more security purpose we can change Apache port number, 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.

=======================================

PidFile logs/httpd.pid
LockFile logs/accept.lock
# Defined in /var/cpanel/cpanel.config: apache_port
Listen 0.0.0.0:80
User nobody
Group nobody
ExtendedStatus On
=======================================

Replace the following line by Listen 0.0.0.0:8080

=======================================

PidFile logs/httpd.pid
LockFile logs/accept.lock
# Defined in /var/cpanel/cpanel.config: apache_port
Listen 0.0.0.0:8080
User nobody
Group nobody
ExtendedStatus On
========================================
Now save the edited file.


For changing https port

Find this line- Listen 443 in the configuration file.
========================================

# Defined in /var/cpanel/cpanel.config: apache_ssl_port
Listen 0.0.0.0:443
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
=========================================

Replace the following line by Listen 0.0.0.0:1023

========================================

# Defined in /var/cpanel/cpanel.config: apache_ssl_port
Listen 0.0.0.0:1023
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl .crl
========================================
Now save the edited file.


Finally restart the Apache service


#/etc/init.d/httpd restart

The Port has been changed successfully.



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

#vi /etc/csf/csf.conf


# 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"

# Allow incoming UDP ports

UDP_IN = "20,21,53"

# Allow outgoing UDP ports

# To allow outgoing traceroute add 33434:33523 to this list

UDP_OUT = "20,21,53,113,123,873,6277"
======================================================================

And Restart the CSF




#/etc/init.d/csf restart









1 comment:

Anonymous said...

Just like with carbs, it's about twice the size of 5 htp for dieting what you're supposed to eat.
After noting the excessive swelling in my legs and listening to me,
the doctor 5 htp for dieting ordered lab work to rule out other possible considerations.
I highly encourage anyone struggling with their weight, when they feel free to
indulge. 5 htp for dieting brings too much focus on diet overhaul
rather than proper diet.

My web blog; modern pool table lights ()