0

I have OS X Server(.app) installed (because I'm a registered developer, so I got it for free). I figured it would be an easy way to flip a switch and get a web server for some static files, for my own local testing, but I can't seem to make it work.

There's a default website with location Default (/Library/Server/Web/Data/Sites/Default), and going to localhost in my browser shows a "Welcome to Lion Server" page, so it's definitely running.

I clicked the "+" button, changed the Domain Name to "*" (I assume that means "any", since it's what the default used), changed the port to 8000 (so it wouldn't collide with the default), changed the location to /Users/ken/Sites (which has a demo index.html file already), and clicked OK. It spins for a few seconds, the window goes away, and I'm back at the list of sites, and my new site isn't there.

I'm sure it'd be easier to install my own Apache or nginx through Homebrew at this point, but I'm invested. How do I make this thing work?

Update: I found /etc/apache2/sites/0000_any_8000_.conf, which appears to be exactly the website I created. I assumed it didn't work since it didn't appear in the Server list of web sites, but going to localhost:8000 actually works! Something is truly weird.

  • 1
    So - going to localhost:8000 is showing your proper site? What isn't working? – Scot Aug 7 '13 at 19:29
  • I guess the specific question should be now "Why don't the websites I add appear in the Server list?". I don't think Apple's intention is that I add a website in the Server app, but then it's invisible, and I have to edit /etc/apache2/ if I want to change something. – Ken Aug 7 '13 at 19:39
2

You do not need OS X Server to serve basic files. The non "server" version of OS X comes with a fully functional apache environment pre-installed. OS X Server is only for more advanced server features which are generally only useful if you're a sysadmin for small business.

To enable the pre-installed apache you just go into system preferences -> sharing and tick the box for "web sharing". Now apache is running on port 80, available to anyone who can access the mac.

You can configure it by editing httpd.conf (for example PHP is installed but disabled - just search for "php" in the config file and un-comment it, then restart apache. htaccess files are also disabled by default). Server Fault is the best place to ask questions about editing httpd.conf.

Since you installed OS X server I suspect you now have two separate copies of apache installed. One configured to run on port 80 (the one in system preferences) and one on port 8000 (the one in os x server).

  • The Apache in System Preferences is not enabled/running, and I confirmed (see above) that the Server one is the one running on port 80. The problem is that Server lets me add sites, but not see or edit them. OS X Server does have "advanced features", but disappearing websites (according to all the documentation I've read) should not be one of them. – Ken Aug 7 '13 at 21:07
  • @Ken I'm not surprised you're having problems, every time I've tried using apache in OS X server I had a seemingly endless list of problems like you're describing. I've been using the apache built into the non-server OS X all day every day for years now and it works perfectly. It really isn't that hard to create virtual host config files manually, learning it will be much easier than figuring out what your current problem is. – Abhi Beckert Aug 8 '13 at 0:15
  • @Ken: Is 'web sharing' still available in the dafault install of OS X 10.11 (El Capitan)? – JS. Nov 16 '15 at 19:15
  • @JS yes but you have to use apachectl instead of the GUI now to start/stop it – Abhi Beckert Nov 16 '15 at 19:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .