Simple Groupware nginx config

In case anyone needs to setup Simple Groupware
http://www.simple-groupware.de/ (it is a web-based groupware that
offers email, calendaring, contacts, tasks, document management,
project management, synchronization with Outlook and cell phones,
full-text search, extensions, etc),
using Debian 6 / Ubuntu 11.10 and Nginx 1.1.12,

here is the config file provided by Simple Groupware’s leader & main
developer:

(ED: it works, but it must be one of the ugliest Nginx config files that
we have seen)

nginx - /etc/nginx/sites-available/sgw

server {
listen 80;
server_name sgw.localhost;
#root sgw; # TODO change to Simple Groupware root directory
access_log /var/log/nginx/sgw.access.log;
error_log /var/log/nginx/sgw.error.log;
root /var/www/sgw;
#index index.php;

WebDAV server

location ~ ^/sgdav {
rewrite . /bin/webdav.php;
}

CMS real URLs

location ~ ^/cms/ {
rewrite ^/cms/ext/(.)$ /bin/ext/cms/$1 last;
rewrite ^/cms/thumbs/(.
)$ /bin/preview.php?filename=$1
last; rewrite ^/cms/(.?)/file/(.)$ /bin/cms.php?page=$1&file=$2 last;
rewrite ^/cms/(.*)$ /bin/cms.php?page=$1 last;
}

Root

location = / {
if ($request_method = “OPTIONS”) {
rewrite . /bin/webdav.php last;
}
try_files /bin/index.php /src/index.php /sgw_installer.php
=404; include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/tmp/php-fpm.socket;
#fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name; }

Root PHP /*.php

location ~ ^/([^/]+.php)$ {
try_files /bin/$1 /src/$1 $uri =404;
#include fastcgi_params;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/tmp/php-fpm.socket;
#fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name; #fastcgi_pass 127.0.0.1:9000; #
use spawn-fcgi (!!) }

sgw src/.php bin/.php

location ~ ^/(src|bin)/([^/]+.php|ext/.+.php)$ {
include fastcgi_params;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/tmp/php-fpm.socket;
#fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name; #fastcgi_pass 127.0.0.1:9000; #
use spawn-fcgi (!!) }

Redirect static files

location ~ ^/(src/|bin/)?(ext/.|docs/.)$ {
try_files /custom/$2 /ext/$2 /bin/$2 /src/$2 $uri =404;
}

Drop all other stuff

location / {
if (!-f $request_filename) { return 404; }
return 403;
}
}

— ends here —

M.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs