Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
self host a gollum wiki.

nginx configuration:

user root admin;

worker_processes  1;

# pid of nginx master process
pid /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    # pull in mime-types. You can break out your config
    # into as many include's as you want to make it cleaner
    include mime.types;

    # set a default type for the rare situation that
    # nothing matches from the mimie-type include
    default_type  application/octet-stream;

    # configure log format
    log_format main '$remote_addr - $remote_user [$time_local] '
                                    '"$request" $status  $body_bytes_sent "$http_referer" '
                                    '"$http_user_agent" "$http_x_forwarded_for"';

    # main access log, I changed the permissions on /var/log so that I
    # don't have to run nginx as sudo. It's my local machine, I don't care
    # too much about the /var/log folder being open...
    access_log  /var/log/nginx_access.log  main;

    # main error log
    error_log  /var/log/nginx_error.log debug;

    # enabled directory listing
    autoindex on;

    # no sendfile on OSX
    sendfile on;

    # These are good default values.
    tcp_nopush        on;
    tcp_nodelay       off;

    # output compression saves bandwidth
    gzip                on;
    gzip_http_version 1.0;
    gzip_comp_level     2;
    gzip_proxied            any;
    gzip_types          text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    include /usr/local/etc/nginx/sites-enabled/*;
}

Gollum nginx configuration:

server {
  listen 80;
  server_name wiki.local;

  location / {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://localhost:4567;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 1M;
  keepalive_timeout 10;
}

OSX plist configuration:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>com.github.gollum</string>
  <key>OnDemand</key>
  <false/>
  <key>UserName</key>
  <string>saito</string>
  <key>ProgramArguments</key>
  <array>
    <string>/Users/saito/Dropbox/Wikis/.gollum.sh</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>

.gollum.sh file:

gollum /Users/saito/Dropbox/Wikis

Dont forget to install gollum.

use system-ruby is a good choice.

sudo gem i gollum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment