0

The Ports on Apache can be changed on two positions:

  • /sites-available/000-default.conf
  • ports.conf

Per Default, both .conf Files dictates Apache to listen on Port 80.

I want to set Apache to listen on a specific port. It seems, that ports.conf overrides the values of 000-default.conf

Where is the correct place to change the Port when the Server runs only on one single IP-Adress?

Gill-Bates
  • 585
  • 2
  • 8
  • 23

1 Answers1

2

Ports can be changed in ports.conf alone. The various site configs contain definitions of what to serve on the open ports. This means that if you define a VirtualHost like this:

<VirtualHost 0.0.0.0:1234>

but you don't have a corresponding Listen 1234 directive, then the VirtualHost definition above is a no-op.

So in order to make Apache listen on an other port, you need to include the Listen directive in ports.conf (technically any other file would do, but it is a good idea to write config snippets where they belong), and make a VirtualHost entry in one of the config files in sites-available. After this, use a2ensite to enable the created config.

Lacek
  • 7,233
  • 24
  • 28