Skip to content

Instantly share code, notes, and snippets.

Last active May 26, 2016
What would you like to do?
NGINX configuration for OntoWiki
server {
listen [::]:80 default_server ipv6only=off;
root /var/www/localhost/;
error_log /tmp/localhost-error.log;
# optionally also index.html index.htm
index index.php;
# You also have to set `post_max_size = 90M` and `upload_max_filesize = 90M` in php.ini
client_max_body_size 90M;
# Make site accessible from http://localhost/
# should be optional
server_name localhost;
# change `/ontowiki` to `/` for the location and rewrite (below) if it is installed in the root
location /ontowiki {
# check if the request is an exception and should not be handled by the index.php
if ($request_filename !~ ((extensions|libraries).*|\.(js|ico|gif|jpg|png|css|swf|json))$) {
set $is_exception "f";
# rewrite all other URLs to index.php
if ($is_exception = "f") {
rewrite ^/ontowiki/(.*)$ /ontowiki/index.php last;
# pass the PHP scripts to FastCGI server
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment