Never use both Internet Sharing and Web Sharing
Do not enable both Web Sharing and Internet Sharing on the same computer, if you want to browse locally-hosted web pages.
I just spent 3/4 of a working day figuring this out. Last week I set up Web Sharing, and it was working great. Browsing my own web pages, submitting forms, and processing them using CGI.
Today, it didn't work. I had a cryptic error: "uWSGI Error: wsgi application not found" when trying to access my own IP address and hostname (http://192.168.2.66 and http://peters-macbook-pro.local).
• I could ping myself
• I could access both of those perfectly fine from another machine on the local network
• I could access my sites using http://localhost/ (this was crucial in finding the problem).
At first, I suspected an apache problem. I edited /etc/apache2/httpd.conf. Having completely restored my configuration, erased all files and rebooted several times, the problem remained. I analysed several errors in the console, including:
httpd: Syntax error on line 114 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/mod_userdir_apple.so into server: dlopen(/usr/libexec/apache2/mod_userdir_apple.so, 10): image not found
httpd: Syntax error on line 106 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/mod_dav_fs.so into server: dlopen(/usr/libexec/apache2/mod_dav_fs.so, 10): Symbol not found: _dav_add_response\n Referenced from: /usr/libexec/apache2/mod_dav_fs.so\n Expected in: flat namespace\n in /usr/libexec/apache2/mod_dav_fs.so
httpd: Could not reliably determine the server's fully qualified domain name, using peters-macbook-pro for ServerName
DocumentRoot [/usr/docs/dummy-host2.example.com] does not exist
I thought it might be a php or python error. No luck trying to disable those.
I eventually asked my supervisor, who suggested it might be a TCP routing issue. I checked all my routes, and discovered that ".local" address are related to bonjour. I tried flushing my TCP routes using "sudo route flush", and observing the table be re-created with "netstat -r", but it still did not work.
Finally, it occurred to me that Internet Sharing was enabled. That's right: bridging between Airport and Ethernet, to give a faster connection between the Mac Mini and my laptop. Completely unrelated to Web Sharing, I had thought before.
Disabling Internet Sharing allowed me to access http://peters-macbook-pro.local and http://192.168.2.66 again.
So if you want to access http://hostname.local or http://ip-address, do not let Internet Sharing be enabled!
This is going down in history with my Segmentation Faults from not running fflush(); after sprintf(stdout).
Peter
MacBook Pro 15", mid-2010, Mac OS X (10.6.3), AppleCare replacement to 15" mid-2007