OS: Ubuntu Linux 20.04.2, Webmin: 1.973, Virtualmin: 6.16, Usermin: 1.823, Authentic Theme: 19.73
I wanted Apache (v2.4.41) to listen to port 802 and 44302 instead of 80 and 443 on my Ubuntu server so I did the following:
-
Edited the port numbers in
/etc/apache2/ports.conf
. Now the file has just two lines and looks like this:Listen 802 Listen 44302
-
Edited the port number in
/etc/apache2/sites-available/000-default.conf
like this:<VirtualHost *:802> .... </VirtualHost>
-
Edited the port number in
/etc/apache2/sites-available/default-ssl.conf
like this:<IfModule mod_ssl.c> <VirtualHost *:44302> .... </VirtualHost> </IfModule>
-
Edited the port number in the other virtual hosts inside
/etc/apache2/sites-available
as well. -
Restarted apache
-
Confirmed apache is listening to the new ports by using
netstat
as well aslsof
and got the following:
netstat:
tcp6 0 0 :::44302 :::* LISTEN 113959/apache2
tcp6 0 0 :::802 :::* LISTEN 113959/apache2
lsof -i:802
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
apache2 113959 root 4u IPv6 3543809823 0t0 TCP *:802 (LISTEN)
apache2 113960 www-data 4u IPv6 3543809823 0t0 TCP *:802 (LISTEN)
apache2 113961 www-data 4u IPv6 3543809823 0t0 TCP *:802 (LISTEN)
lsof -i:44302
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
apache2 117939 root 6u IPv6 3547650042 0t0 TCP *:44302 (LISTEN)
apache2 117940 www-data 6u IPv6 3547650042 0t0 TCP *:44302 (LISTEN)
apache2 117941 www-data 6u IPv6 3547650042 0t0 TCP *:44302 (LISTEN)
-
Confirmed nothing else is listening port 80 and 443 by using both
netstat
andlsof
. -
Change the ports for the existing virtual servers by going to
Server Configuration > Change IP Adress
and added the new ports there. Now Current web ports show802 (HTTP) 44302 (HTTPS)
. -
Change the default ports in
System Settings > Server Templates > Default Settings
to 802 and 44302. -
Restarted apache and webmin.
Now when I try to access any of the websites or even the server ip address on port 802, I get a This site can’t be reached
error. Sites can be accessed fine on port 44302 however.
http://ipaddress:802
OR http://example.com:802
---- DOESN’T WORK
https://ipaddress:44302
OR https://example.com:44302
---- WORKS FINE
What am I doing wrong and how can I fix this?