Last active
May 26, 2016 21:42
-
-
Save white-gecko/3739707 to your computer and use it in GitHub Desktop.
NGINX configuration for OntoWiki
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
fastcgi_param ONTOWIKI_APACHE_MOD_REWRITE_ENABLED 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment