Using Apache with munki server

jnraine edited this page Jun 6, 2012 · 8 revisions

Test your Rails app

  • Ensure your munki server production environment is properly configured
    • cd /path/to/your/munkiserver
    • rails s -e production
    • Browse your site (localhost:3000 by default)

Install Passenger

  • Install Passenger gem and apache module (more details)
    • gem install passenger
    • passenger-install-apache2-module
  • Edit Apache config
    • Open /etc/apache2/httpd.conf
    • Add the lines specified by the Passenger apache mod installer. Something like the following:
LoadModule passenger_module /Users/jraine/.rvm/gems/ruby-1.9.3-p123/gems/passenger-3.0.2/ext/apache2/
PassengerRoot /Users/jraine/.rvm/gems/ruby-1.9.3-p123/gems/passenger-3.0.2@/.rvm/gems/ruby-1.9.2-rc2/gems/passenger-3.0.2
PassengerRuby /Users/jraine/.rvm/wrappers/ruby-1.9.3-p123/ruby

Configure a virtual host

  • Add a munki server vhost
    • Open /etc/apache2/extra/httpd-vhosts.conf (or wherever you’d like to define the vhost)
    • Add the following, adjusting for your environment1:
<VirtualHost *:80>
  ServerName munki.local
  DocumentRoot "/path/to/your/munkiserver/public"
  <Directory "/path/to/your/munkiserver/public">
    Order allow,deny
    Allow from all

Or, if you are on OS X, you can use the Passenger preference pane to configure a host.

Install mod_xsendfile module

In order to utilize all the goodness that is Apache when downloading packages from the server, a module called “mod_xsendfile” needs to be installed. Thankfully, this is really simple, even if you have never installed an Apache mod before. From the mod_xsendfile website:

  • Grab the source
  • Compile and install apxs -cia mod_xsendfile.c
  • Add this to your VirtualHost
LoadModule xsendfile_module   /usr/libexec/apache2/
RequestHeader Set X-Sendfile-Type X-Sendfile
ProxyPassReverse / http://localhost:8001/
XSendFile on
XSendFilePath /path/to/your/package/store

Restart Apache

  • Restart apache
    • sudo apachectl graceful2
  • Visit your server
    • http://munki.local
    • If you need to restart munki server, simply touch tmp/restart.txt within your munki server root directory.


1 Replace the “munki.local” with your servers FQDN and the “/path/to/your/munkiserver/public” with the path to the public directory within your munki server directory.

2 If experiencing /usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument see here.