A question about Localhost with Safari

Ryan Schmidt ryandesign at macports.org
Sat Jan 3 23:38:45 PST 2015


On Jan 4, 2015, at 1:06 AM, William H. Magill wrote:

> What triggered my query was the fact that various "how to" pages describe using "localhost" as a mechanic for testing certain web based services -- which did not work!
> https://trac.macports.org/wiki/howto/Apache2
> I'm guessing that the over-arching description that one can define "ServerName localhost:80" is simply no longer an "appropriate" statement for OSX and Yosemite. And apparently for Apache2 in general -- it works and passes validation, but the results of its use are not predictable.
> 
> It also appears that the function of the ServerName directive has changed. The current Apache manual http://httpd.apache.org/docs/2.2/mod/core.html#servername
> describes its syntax as requiring a FQDN -- which neither Localhost nor IP address constructs (127.0.0,1) really are.
> (Apparently the directive is directly related to various DOS, Virtual Host and other DNS issues and is supplanted by the results from "gethostname" C function.
> http://httpd.apache.org/docs/2.2/dns-caveats.html
> 
> In short, it appears that the old "localhost" shortcut needs to disappear from the documentation. For no other reason than the fact that results from using it are not reproducible.

I don't know why using "ServerName localhost" wouldn't work. I wouldn't remove it from any documentation. I would guess the Apache documentation says "fully-qualified domain name" to distinguish from "local name only". In other words, if your server is www.example.com, you should put "ServerName www.example.com" and not "ServerName www".

I don't know of any reason to declare the port number in the ServerName directive since the port number is already specified in the Listen directive.



More information about the macports-users mailing list