Changing Apache port

OS: Ubuntu Linux 20.04.2, Webmin: 1.973, Virtualmin: 6.16, Usermin: 1.823, Authentic Theme: 19.73

I wanted to change the Apache ports from 80 and 443 to 82 and 445.

I made the necessary changes in ports.conf as well as in 000-default.conf and default-ssl.conf and netstat shows that apache is listening to the new ports now:

tcp6       0      0 :::82        :::*            LISTEN      74671/apache2
tcp6       0      0 :::445       :::*            LISTEN      74671/apache2

In Virtualmin, I did the following two things:

  • Change the ports for the default virtual server (currently have only this virtual server btw) by going to Server Configuration > Change IP Adress and added the new ports there. Now Current web ports show 82 (HTTP) 445 (HTTPS).

  • Change the default ports in System Settings > Server Templates > Default Settings to 82 and 443.

Both apache and webmin were restarted after all the changes above were made.

Now when I try to open example.com:82 (domain of the virtual server), I get a “This site can’t be reached” error.

What am I doing wrong and how do I fix this?

@shillongserver I think you should not change anything there. You only go to that preticular settings if your server ip changed but most of the time if not need it to touch it there… just retrieve changes you made and check if your ports 82 and 445 are open in firewall specially if you’re behind nat. If so, it should work as you wanted.