1

Some users report that Apache 2 on Windows is running slow over the network. I know that I was able to speed up MySQL by using 127.0.0.1 for the MySQL connection address. I also found that in a ServerName that is localhost:80.

If I change ServerName to 127.0.0.1:80 will this cause any side effects with networking from machines on the network?

What are the pros and cons of making this change?

3
+150

If that's the default VirtualHost, either by being the first VirtualHost defined on that IP address/port combination or because the VirtualHost tag contains _default_ (see VirtualHost Examples - Using default vhosts - Apache HTTP Server), then it shouldn't matter if you change it from localhost:80 to 127.0.0.1:80.

As it stands now, remote machines shouldn't be able to access it anyway using the name localhost (i.e., users wouldn't go to http://localhost unless they were on the machine itself) since that would resolve to their machine and not the machine you're running Apache on.

Since they're not using localhost to access it, changing it shouldn't matter as the default VirtualHost in Apache will field incoming requests regardless of what you put for ServerName or ServerAlias.

0

If I change SeverName to 127.0.0.1:80 will this cause any side effects with networking from machines on the network?

Yes. This will cut off access from outside the server itself. 127.0.0.1 is an IP address of the loopback interface, which is only used for network communication between different processes on the same server.

What are the pros and cons of making this change?

Well, I think those are obvious now. :)

If you want to run apache, do yourself a favor and run it on a proper linux or BSD server. It's always been a hack to get apache running on Windows. It's possible, but not ideal for many reasons. If you're stuck with Windows for some reason, just use IIS.

4
  • When Changed ServerName to 127.0.0.1 in http.conf (NOT IN VIRTUAL HOST); it worked fine from inside and outside the network. It seems your scenario isn't true. – Chris Muench Jul 15 '15 at 13:01
  • Any redirection URLs generated by the server will use ServerName which won't work well on clients if its 127 address. – Brian Jul 16 '15 at 21:11
  • 1
    But why would it be any different if it was localhost? – Chris Muench Jul 16 '15 at 22:04
  • @ChrisMuench It shouldn't be different on any typically-configured machines (i.e. ones that don't have the hosts file modified such that "localhost" points to something other than 127.0.0.1). I'm guessing EEAA probably just skimmed that it was set to that since it's not a common setup on public-facing web servers. – sa289 Jul 18 '15 at 2:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.