docker-foswiki/nginx.default.conf

82 lines
2.4 KiB
Plaintext

server {
# docker-foswiki version
listen 80;
server_name _;
set $foswiki_root /var/www/foswiki; # <=== Path to expanded foswiki distribution
root /var/www/html;
index index.html;
access_log /var/log/nginx/foswiki-access.log;
error_log /var/log/nginx/foswiki-error.log debug;
# Uncomment for htpasswd
#auth_basic "FOSWiki";
#auth_basic_user_file $foswiki_root/data/.htpasswd;
# raise upload limit (foswiki has its own limit : %ATTACHFILESIZELIMIT% in System/PreferenceSettings)
client_max_body_size 50M;
# browsers tend to search for a favicons and robots.txt in the root directory: if it is there fine, if not don't bother
location /favicon.ico {
log_not_found off;
access_log off;
}
location /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location = / {
root $foswiki_root;
rewrite .* /bin/view;
}
# redirect short urls to view
location ~ ^/(?:bin/)?([A-Z_].*)$ {
rewrite ^/(.*)$ /bin/view/$1 last;
}
# static files that we don't need to authenticate, i.e. css and js
location ~ ^/pub/(System|Applications|images|cache)/ {
root $foswiki_root;
expires 8h;
gzip_static on;
}
# any other static files need to be sanctioned by the foswiki backened
location /pub {
# The following setting must be in LocalSite.cfg
# {XSendFileContrib}{Header} = 'X-Accel-Redirect';
# {XSendFileContrib}{Location} = '/files';
rewrite ^/pub/(.*)$ /bin/xsendfile/$1;
}
# internal location that sendfile serves sanctioned static files from
location /files {
internal;
alias $foswiki_root/pub/;
expires 8h;
access_log off;
}
# deny any direct access to these directores
# note that this only is required in case the document root equals the $foswiki_root
location ~ (^/lib|^/data|^/locale|^/templates|^/tools|^/work) {
deny all;
}
location ~ ^/bin/([a-z]+) {
gzip off;
# a request taking more than 2 minutes is considered an error
fastcgi_read_timeout 120s;
fastcgi_split_path_info ^/bin/(.+?)(/.*)$;
fastcgi_param SCRIPT_FILENAME $foswiki_root/bin/foswiki.fcgi;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
}
}