Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Running web server on Yosemite

I've been running a web server on Mac-computer since the mid 90ies, hacking httpd.conf files but when I upgraded to Yosemite (Mac OS X 10.10) and Mac OS X Server I can't get anything to work.


As a starting point I only want to get myserver:80 to function properly without anything being redirected to port 443. I also want to have my own web site and not the default web site that Yosemite ships with. I do _not_ want to be forced to use myserver/~Auser


I find a http.conf file in /private/etc/apache2 but it doesn't seem to be affected by any changes I make in the Server application and if I change the httpd.conf file it doesn't seem to influence the server at all.


The information I find on the web, e.g. http://krypted.com/mac-os-x-server/setting-up-and-using-web-services-in-os-x-mav ericks-server/ worries me since it seems that I want to do is no longer possible. Is there really no way out?

Mac mini, OS X Yosemite (10.10.1)

Posted on Dec 2, 2014 10:02 AM

Reply
5 replies

Dec 2, 2014 11:24 PM in response to Mattias Alveteg

So, I think I found the answer to one of my three questions: In the manuals Apple provides (https://www.apple.com/support/osxserver/) there seem to be nothing about advanced apache configuration or indeed apache configuration at all. InOS X Lion: Advanced Apache configuration - Apple Support which comes with the warning "This article has been archived and is no longer updated by Apple" they say, however,


"Place global-scope directives in /etc/apache2/httpd.conf This file is not overwritten by Server.app. Directives there are generally inherited by virtual hosts unless they are specifically overridden."


so that probably answers one of my questions. That still leaves me with two questions:


1. How to make OS X Server not to redirect to 443. The server application does not allow me to delete the default SSL (port 443) server and for some reason everything on my server is redirected to 443. My provider has only opened port 80 for me and that is fine with me, but apparently OS X Server disagrees.


2. How to move web site folder to another folder without any of the pages that Apple ships with Yosemite and _without_ having to use obscure myserver/~aUser URLs


I've been a Mac user since the late 80:ies but this makes me consider throwing my Mac server out the window and start running Linux instead.

Dec 3, 2014 2:43 AM in response to Mattias Alveteg

So I partly solved question 1 and 2 by doing the following:


1. In Server application change document location of the two default servers to whatever folder you want to use

2. Make sure that folder is readable to the web user (I set it to _www) using chown -R in terminal

3. Create a new server in the Server application that uses the same host name as the default servers (this will cause the Server application to protest, but ignore that) and the same folder as you set the two default folders to use

4. in httpd.conf (/private/etc/apache2/httpd.conf) change

4A. Change the ServerName command by adding :80 to the end

4B. The DocumentRoot and the <Directory command that follows it to use the same folder as you specified aboves:80

4C. Comment out the line Include /private/etc/apache2/extra/httpd-autoindex.conf if you don't want to use autoindex

4D I've also commented out the section <IfModule ssl_module> but I'm not sure that was part of the solution

4E If you, like me, do not need php5 and do not want the server to produce directory listings, comment out the lines


Include /private/etc/apache2/other/*.conf

Loadmodule autoindex_module libexec/apache2/mod_autoindex.so


So far so good. My web site is now available if you know exactly what URL to type in (myserver/default.html rather than myserver/), but one question remains:


Q3: I can't get the DirectoryIndex command to work. In the past I just turned off apache's ability to make directory listings and wrote the files it should look for in the DirectoryIndex command (not including "Indexes" in the options of the Directory command.

Dec 3, 2014 6:13 AM in response to Mattias Alveteg

ok. So it seems that the Server App is pretty ignorant of what you actually write in httpd.conf. If you, for example specify filenames in a DirectoryIndex statement that will not help you since the Server App has its own setting for this and whatever you specify in the Websites setting in the Server App overrules the things you wrote in the httpd.conf file. What you end up with is a httpd.conf file that you can only partially trust to do what you tells it to do. This sounds like a potential security threat to me. If what I write in httpd.conf is overruled (by another conf file? or how does this work?) in a way I can't see through, how can I know what to trust?


What seems to finally solve my Q3 above was:


* In the Server app, remove all index files in the Websites settings for the two default servers

* In the same settings, change the index files and their relative order to whatever fits your purposes

* I do have a DirectoryIndex statement in my <Directory section of my httpd.conf, but whether that is part of the solution I can't say


and BTW, In the websites settings for the default non-ssl server, I found a redirect to https://{servername} (which I didn't enter), so that explains the mysterious redirect to port 443

Jul 27, 2015 11:38 AM in response to Stephen Bloch

No, you don't have to buy Server.app.


Everything is still there, it's just the user interface that's missing. Apache is not started by default, but you can easily start it manually from Terminal.app


Here is the one line command you have to issue only once (it will survive reboot)


sudo launchctl load -w /System/Library/LaunchDeamons/org.apache.httpd.plist


You have to enter your account passwort (it won't show while you type), hit enter and everything is well.


Apache uses the standard config file from /etc/apache2/....


Once you install Server.app Apache will be started with a different set of config files ( from /Library/Server/Web/apache2/Config/). You can only have either one or the other mechanism.


Hope this helps

---markus---

Running web server on Yosemite

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.