I recently had a web server behind a load balancer that needed to listen on a different port because the load balancer was translating port 80 traffic for security. Thankfully, changing the ports that HTTPd listens on is relatively simple.
Crack open your favorite command line editor. For the purposes of this example, I’ll be using vim.
This is a relatively large file, so you’ll have to scroll for some time to find what we’re looking for. Otherwise, you can use search. Scroll down until you find a section that looks like
# # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, in addition to the default. See also the <VirtualHost> # directive. # # Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses (0.0.0.0) # # Listen 188.8.131.52:80 # Listen 80
Depending on your needs, whatever ports you need, add "Listen <port>" in this section. If for instance you need httpd to listen for an ssl (https) encrypted connection, you can add
Once you’ve made the changes you want, save and close the file and run the command
That’s all there is to it! Now for lunch.