Web Sharing, despite its poorly crafted feature name, was the simple interface in the OS X System Preferences that turned on Apache in the background.  In OS X 10.8, however, that option has been removed from the “Sharing” section.

It appears that in the developer preview build currently available, though, all of the binary Apache stuff is still ready and waiting to be run, assuming you know how to run it.

The proper way to manage your Apache installation now is to use the “Server” management app found on the app store.  Now, this is a $50 purchase normally, and the app installs all the services needed to run server features for Calendar, Contacts, User & Group, DNS, Mail, VPS, etc, etc.

Since you have OS X 10.8 through the legitimate Developer program, you can generate a code via the developer site to get the Server app for 10.8 downloaded from the App Store.

The UI has changed around a bit if you’re accustomed to merely checking the “Web Sharing” box and being done with it, but I think it makes enough sense and it’s definitely more powerful.

 

16 Responses to Panic! What happened to Web Sharing in OS X 10.8 Mountain Lion?

  1. Vish says:

    So how does one test files using localhost? I just downloaded the DP of Mountain Lion but like you said the web sharing is not available and I have been looking for a solution for the past 2 days trying to get this thing to work. If you have any suggestions to get this thing to work, email me! I will keep you posted if I hear something.

    Thanks!

    • Tim says:

      The server tool wants you to be running their DNS service to register a name such as “www.mysite.com”. This resolves only for you locally, and for any machines on the network referring to your box as a DNS host. You can make up whatever well-formed domain name you want for the DNS configuration, and you appear to be able to point it at 127.0.0.1.

      Once the DNS service is directing queries for “www.mysite.com” to localhost like this, you can use the Web service to add an entry that uses this domain name. You set the document root via the menu item called “Store Site Files In”.

      This is cumbersome for lots of small sites, so one thing I did was to make a http://www.sites.local DNS entry and then point that document root at my old ~/Sites directory.

      Instead of bothering with the DNS thing, you could, I assume, modify your hosts file to locally short-circuit the domain name lookup to your 127.0.0.1 IP, but that’s not the best option for everyone. This server tool is trying to give you a UI to the DNS entries, and the hosts file goes behind its back. It’s a terribly useful thing, but as we say in the programming industry, “explicit is better than implicit”.

      • Andrew Sullivan says:

        Yes, of course, what we want everyone in the world to do is start setting up rogue nameservers for things. Genius!

        • Tim says:

          So, the nameservers in question are for the local network only, and even then, only for the computers on the local network that are using you as a DNS source. This is extremely common practice for local intranet. The difference here is that I need a way to access sites in my own browser using VirtualHosts, something the straight IP can’t give you.

  2. vish says:

    You mean I can’t get localhost host to work without the server.app? I checked my host files and they are pointing to the default IP. The error which I get is “Safari cannot find the server localhost.”

    • Tim says:

      The truth is that the “Apache HTTP” server software exists on your system one way or another anyway, and the old checkbox UI just started it for you. The OS isn’t serving your browser queries automatically, and it never has, in truth. So now with 10.8, you can start it directly from a terminal “sudo apachectl start” (or stop or restart), but the problem is that you then have to concern yourself with editing the Apache configuration by hand to include the DocumentRoot directory that you want to use for your sites..

      The advantage of this Server app is that it’s providing a UI for configuring Apache.

    • Tim says:

      Also… I came across this guy’s replacement Preferences Pane for re-enabling the Web Sharing checkbox in its own Pane (http://clickontyler.com/blog/2012/02/web-sharing-mountain-lion/), but you’re still going to have the problem with creating the Apache configuration to point the DocumentRoot at your Sites folder. Mountain Lion appears to be removing the automatic use of your user Sites folder. I couldn’t use this little Preferences Pane because Apache was failing to start in the background, and it was unclear exactly why, despite the Console messages from the error.

      If the Apache stuff is outside of your comfort zone, you might want to look at the link’d author’s project VirtualHostX, which tries to provide a dedicated UI for managing these configurations. I don’t know for sure what the support for 10.8 is yet.

  3. Vish says:

    I tried installing the solution mentioned in the clickontyler and emailed him as well but he never responded. I did this before I found your article. Anyways, last night I found that the httpd process does not load even after I start apache using terminal.
    I ran a apachectl configtest to get the status and it found some syntax errors in the httpd conf file. I commented the and ran the test again to check if there were more error. Later when I restarted the apache and saw if the process actually loaded using activity monitor, to my surprise httpd did not load. Now i need to figure out how to start apache as the terminal command isn’t working.

  4. Vish says:

    After 3 days I finally got the solution to enable web sharing for Mountain Lion OSX 10.8.
    Please check the if you get the following status message: Open Terminal and type sudo httpd -E /private/var/log/apache2. If you get the following error make_sock: could not bind to address 0.0.0.0:80 no listening sockets available
    this means that there is another application listening to port :80 and that’s what creating the conflict.
    Open /etc/apache2/httpd.conf.default and use this to overwrite your httpd.conf file.
    Open Activity Monitor and in terminal use the sudo lsof -i:80 to check all applications using port 80. Also, sudo apachectl start and stop does not work because the port may be used by another application (in my case for some reason DropBox was using the port) strange!. In order to kill all other processes and children using port 80 i used sudo apachectl -k stop and then sudo apachectl -k start to restart httpd service, this worked! but this is a temp fix as every time you reboot httpd does not start and you will need to restart apache using the sudo apachectl -k start command. I hope it works! ENJOY!

  5. [...]     libexec/apache2/mod_bonjour.soBecause that module no longer exists in 10.8.  As noted here, Apple have removed the sharing toggle for Web Sharing (Apache) so, use these commands to [...]

  6. Chad Schneider says:

    Hello Tim,
    I was curious if you are referring to the OS X Server application or a different one? Thanks in advance for your input

    • Tim says:

      Indeed it is. Now that Mountain Lion is released, the server software app has tightened up and is much less buggy than when I worked out how to use it. Best of luck!

  7. Hello Tim,

    Before Mountain Lion was used to using the actual IP of the machine so I could test LOCALLY on a Mac through different devices (iPhone, iPad, Windows, etc).

    Now with this localhost, turning it on via the command line, how can I use my ACTUAL IP?

    • Tim says:

      The Apache web server should by default respond on any IP that the machine has assigned. This means it will respond to itself via “localhost” and “127.0.0.1”, and from any local IP it has assigned, like “10.0.0.5” or “192.168.1.5”. Running “ifconfig” from the command line would reveal your IP addresses.

      Websharing isn’t enabled by default, but it still works the same way. Whatever your IP address is, that’s what you’d enter into another device’s address bar.

      Aside:

      This is all determined by the httpd.conf Apache configuration. It’s located at “/etc/apache2/httpd.conf”. There is a line labeled “Listen 80″ by default. That 80 is a port number, and it’s omitting an IP, therefore allowing Apache to respond to any IP interface on the machine. If you wanted to only respond to localhost, you’d enter “Listen 127.0.0.1:80″, and if you wanted only to respond to out-facing IPs (not typical) you’d enter something like “Listen 10.0.0.5:80″.

  8. Etienne Bley says:

    OK – there was a hint above – run the following to see errors
    sudo httpd -E /private/var/log/apache2

    . I had a module installed (SVN – but that is merely a detail) and it was loaded in the ‘other’ category at the end of the httpd.conf file.

    Here is the output of the command line – it pointed to the issue.
    httpd: Syntax error on line 500 of /private/etc/apache2/httpd.conf: Syntax error on line 1 of /private/etc/apache2/other/svn.conf: Cannot load /usr/libexec/apache2/mod_dav_svn.so into server: dlopen(/usr/libexec/apache2/mod_dav_svn.so, 10): image not found

    I renamed the svn.conf file to svn.deletedconffile and apache started right up. I also had to chmod to 755 all my Sites files – not 644 which is suggested on some sites.

  9. Mike says:

    Not only did they remove it, they are not honouring full port functionality in Apache.

    This should be possible:

    Listen 80
    Listen 81
    Listen 1234

    However on OSX 10.8 you can only specify one listen statement!!!! Port 80 defaults anyway, so you can only listen on two ports (80 and one other).

    i.e. you can only have one listen like:

    Listen 1234

    And this will allow your web server to listen on 80 (by default) and 1234 as the Listen statement specifies. This took me quite a few hours to work out. Thanks Apple!!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>