apache2 change port from 443 to 7443

21,901

Solution 1

You must change the port in two places :

In the VirtualHost :

<VirtualHost _default_:7443>

And in the Listen directive :

Listen 80
Listen 7443

To just see what Apache understand on your ports and VirtualHosts binding, just run :

httpd -S

Solution 2

don't forget to enable SSL!

a2enmod ssl

in /etc/apache2/ports.conf , do NOT add Listen 9443 outside ssl_module!

Listen 9980
<IfModule ssl_module>
    Listen 9443
</IfModule>

in /etc/apache2/sites-enabled/default-ssl.conf

<VirtualHost _default_:9443>

Solution 3

You must have a Listen line somewhere in your config so make sure that is set to 7443 too.

See here for more information: https://httpd.apache.org/docs/2.4/bind.html

Solution 4

You also have to change the listening port under /etc/apache2/ports.conf (Assuming your tags are correct)

Use this command to show you all ports listening for all applications in both tcp & udp. Apache will only be on TCP, but it's a good command to know anyway.

netstat -tulpn
Share:
21,901

Related videos on Youtube

adviner
Author by

adviner

Updated on September 18, 2022

Comments

  • adviner
    adviner over 1 year

    I'm using the default apache ssl conf file "default-ssl.conf"

    If i leave it alone using my self signed cert i can get to the page using 443:

    <VirtualHost _default_:443>
        ServerAdmin [email protected]
        ServerName myhost:443
    

    but once i change it to port 7443 and restart I cant get to the page. I call the page as follows:

    https://myip:7443/site and nothing happens but
    https://myip/site works fine.
    

    Each time I change it I call the apache2 restart. Im running latest Debian in a vm. I dont think running in a vm is the issue since port 443 works fine. I've looked and dont really see any solution on google that helped me. I though changing the port to 7443 would be the only thing that I would require.

  • Neil
    Neil over 8 years
    Good catch haha. Fixed.