Score:0

Cannot get HomeBrew Apache/2.4.54 Virtual Hosts to listen on all Network Interfaces

bt flag

I have tried to configure Apache virtual hosts to respond to connections on all of my network interfaces (external, private, loopback) on port 8080, but to no luck. Here's what I have done so far on my MacOS Monterey:

  1. Made sure the virtual host module is enabled in httpd.conf by uncommenting the #

  2. Read and followed the official Apache documentation https://httpd.apache.org/docs/2.4/vhosts/ on virtual hosts.

  3. Temporarily Disabled Firewall

  4. The virtual hosts file is listening to port 8080 on all network interfaces (Listen 8080). The virtual hosts file (using IP-Based virtual hosts) looks like this:

Listen 8080
<VirtualHost *:8080>
         DocumentRoot <pathToDirectory>
         ServerName <someName>
    <Directory <sameAsDocumentRoot>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
    </Directory>
</VirtualHost>

To test, I stopped the web server using brew services stop httpd and started it again with brew services start httpd. I visited both 127.0.0.1:8080 and 192.168.1.2:8080 (private ip) on Chrome which both lead to the status message: The requested URL / was not found on this server. However, visiting localhost:8080 successfully retrieves my webpage.

My question then is how can I make Apache bind to all network interfaces (on port 8080) and be able to access the associated IP addresses on a web browser by configuring virtual hosts? Explicit IP address mappings work but is it possible to have a single <VirtualHost> directive that can respond to requests from any network interface? Any help will be much appreciated!

ezra-s avatar
ru flag
Apache will use all interfaces available, that is.. if they are available. Check of something else is using that port, for example a command like "sudo lsof -P -i tcp:8080" will show all processes using that port for every interface.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.