Newsroom Update

Beginning in May, a special Today at Apple series titled “Made for Business” will offer small business owners and entrepreneurs free opportunities to learn how Apple products and services can support their growth and success. Learn more >

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

Managing Virtual Hosts on os X Server 10.7

Hello together,


how can I manage my virtual hosts on Lion Server e. g. add some directives to the configuration.


I created some VirtualHosts with Server.app.

The configuration files reside in /etc/apache2/sites and usualy I would just edit an add directives directly.


But in /etc/apache2/ReadMe.txt it says:


Administrators are strongly encouraged to use the webapp mechanism instead of modifying virtual host config files directly. In general, you can place Apache configuration directives in an "Include" file, and create a webapp.plist file that references that Include file. You can then activate or de-activate that Include file using webappctl(8).


How does this work?

The manpages didn´t help.


How could I for example add a ScriptAlias directive safely?


regards

macmartin

Posted on Feb 2, 2013 9:45 PM

Reply
4 replies

Feb 12, 2013 12:33 PM in response to macmartin

Did anyone help you with this? I am interested in this as well but in relation to Mountain Lion Server.


I wanted to specify something like:


Order Allow, DenyAllow from 192.168.0/255.255.255.0Deny from 192.168.0.1


so as to restrict apache to responding to users on the Local Area Network but not responding to the Internet gateway/NAT router on 192.168.0.1.


For virtual host websites, i.e. additional websites created via the Websites service in Server app, and also for the default "Server Website" and "Server Website (SSL)" well:


The latter are controlled. "somewhat", by an httpd_server_app.conf file and you are meant to be able to include files for your personal settings although I have had trouble getting that to work (everything seems so sensitive for some reason).


For the former, the generated virtual host files created by the Server app are stored in:


/Library/Server/Web/Config/apache2/sites/


I have tried including a file into my virtual host files in this location but everytime I do so all of the websites stop working. In Mountain Lion Server you are also recommended to use the webapp mechanism instead of modifying virtual host config files directly. And, like you I cannot find an example of how to do this and to do so in a manner which won't upset the Server app. Maybe the documentation needs expanding?


I am surprised at this "adding another layer of work" when we should be able to safely include a file and for the thing to work.


If you get an answer from someone who knows how to do the webapp thing with a simple example could you please let me know. Thanks

Feb 12, 2013 1:57 PM in response to zzTontozz

Hello zzTontozz,


no I didn't get any response.


Somewhere I have read that one should add aditional conf files in the /etc/apache2/sites directory

e.g.

0001_any_80_[...].conf

and include those in the 0000_any_80_[...].conf file.

This works but only as long as you don´t open the webserver tab of Server.app because this results in rewriting the 0000_any_80_[...].conf files an droping the Include directives.


I _do_ know how to manage apache but in OS X Server this becomes a real drag.

It´s not only more complicated but it is also lousily documented in the manpages.


Regards

macmartin

Feb 14, 2013 1:28 PM in response to macmartin

Hello again,


I have been playing around with .htaccess files for virtual host sites on Mountain Lion Server. Note, Server app on Mountain Lion Server is different to Lion Server.


I enabled "Allow overrides using .htaccess files" via the Mountain Lion Server Server app's Websites service and added a .htaccess file into the root directory of the virtual host under sites. Mountain Lion Server didn't get upset. I'm not sure what the performance hit will be by doing this but it's probably no big deal for sites that would use OSX server.

Managing Virtual Hosts on os X Server 10.7

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