# Simple Groupware nginx config

**URL:** <https://www.ruby-forum.com/t/simple-groupware-nginx-config/215733>\
**Category:** NGINX\
**Created:** [January 13, 2012, 9:48pm UTC](https://www.ruby-forum.com/t/simple-groupware-nginx-config/215733 "2012-01-13T21:48:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [January 13, 2012, 9:48pm UTC](https://www.ruby-forum.com/t/simple-groupware-nginx-config/215733/1 "2012-01-13T21:48:40Z")

</div>

In case anyone needs to setup Simple Groupware  
[http://www.simple-groupware.de/](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.
