Simple Groupware nginx config
Mark Alan
varia at e-healthexpert.org
Fri Jan 13 20:48:01 UTC 2012
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.
More information about the nginx
mailing list