server { listen 127.0.0.1:8081 default; server_name www.gnuheidix.de; rewrite ^ http://gnuheidix.de$request_uri? permanent; } server { listen 127.0.0.1:8081; root /srv/www/gnuheidix.de; server_name gnuheidix.de; location / { # First attempt to serve request as file, then # as directory, then fall back to index.html try_files $uri $uri/ /index.html; } location ~ (\.inc\.php|\.tpl|\.sql|\.tpl\.php|\.db)$ { deny all; } location ~ \.php$ { # Match the port below to the one used for spawn-fcgi try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; } location ~ \.(png|jpg|gif|woff|ico|css|js)$ { expires 30d; } # s9y rewrite rules rewrite ^/htmlarea/(.*) /htmlarea/$1 break; rewrite ^/googledeadbeefcafebabe\.html /googledeadbeefcafebabe.html break; rewrite ^/archives([/A-Za-z0-9]+)\.html /index.php?url=/archives/$1.html; rewrite ^/pages([/A-Za-z0-9]+)\.html /index.php?url=/pages/$1.html; rewrite ^/([0-9]+)[_\-][0-9a-z_\-]*\.html /index.php?url=$1-article.html; rewrite ^/feeds/(.*) /index.php?url=/feeds/$1; rewrite ^/unsubscribe/(.*)/([0-9]+) /index.php?url=/unsubscribe/$1/$2; rewrite ^/approve/(.*)/(.*)/([0-9]+) /index.php?url=approve/$1/$2/$3; rewrite ^/delete/(.*)/(.*)/([0-9]+) /index.php?url=delete/$1/$2/$3; rewrite ^/(admin|entries)(/.+)? /index.php?url=admin/; rewrite ^/archive$ /index.php?url=/archive; rewrite ^/categories/([0-9]+) /index.php?url=/categories/$1; rewrite ^/plugin/(.*) /index.php?url=plugin/$1; rewrite ^/pages/(.*) /index.php?url=/pages/$1; rewrite ^/search/(.*) /index.php?url=/search/$1; rewrite ^/authors/([0-9]+) /index.php?url=/authors/$1; rewrite ^/(.*\.html?)$ /index.php?url=/$1; rewrite ^/(serendipity\.css|serendipity_admin\.css)$ /index.php?url=/$1; rewrite ^/(index|atom|rss|b2rss|b2rdf).(rss|rdf|rss2|xml)$ /rss.php?file=$1&ext=$2; # redirect server error pages to the static page /50x.html error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/www; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one location ~ /\.htaccess { deny all; } }