Apache Listen Directive
The Listen directive instructs Apache to listen to more than one IP address or port; by default it responds to requests on all IP interfaces, but only on the port given by the Port directive. You can use this directive multiple times.
Task: Change Apache port
Open /etc/apache2/ports.conf file, enter:
OR
To make the server accept connections on both port 8010, enter:
To make the server accept connections on both port 80 and port 8010, use:
# vi /etc/apache2/ports.conf
OR
$ sudo vi /etc/apache2/ports.conf
To make the server accept connections on both port 8010, enter:
Listen 8010
To make the server accept connections on both port 80 and port 8010, use:
Listen 80
Listen 8010
Task: Accept connections on specific IP / interface port
You need to use network interfaces IP address. For example, to make the server accept connections on IP 202.54.1.2 and port 80, enter:
To make the server accept connections on two specified interfaces and port numbers, enter:
Save and close the file. Restart Apache 2 webserver:
OR
Listen 202.54.1.2:80
To make the server accept connections on two specified interfaces and port numbers, enter:
Listen 202.54.2.1:80
Listen 202.54.2.5:8010
Save and close the file. Restart Apache 2 webserver:
# /etc/init.d/apache2 restart
OR
$ sudo /etc/init.d/apache2 restart
How do I verify port and IP binding working ?
Use netstat command to find out if Apache is listening on a specific port or not, use:
Sample output:
# netstat -tulpn
# netstat -tulpn | grep :80
# netstat -tulpn | grep :8010
# netstat -tulpn| grep 202.54.1.2:80
Sample output:
tcp 0 0 202.54.1.2:80 0.0.0.0:*
No hay comentarios:
Publicar un comentario