summaryrefslogtreecommitdiff
path: root/etc/nginx/wiki.conf.sample
blob: fbb036fa94a60303294577dca4ca3dca7df4e72a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# ----
# Copyright (C) 2013-2020 - Reevo (http://reevo.org)
# License: Affero GPL version 3 - http://www.gnu.org/licenses/agpl.html
# ES: Este archivos es parte de: reevo-web (http://git.reevo.org/reevo/reevo-2020)
# EN: This file is part of: reevo-2020 (http://git.reevo.org/reevo/reevo-2020)
# ----

server {
	server_name wiki.example.org;
	root /srv/reevo-2020/www/wiki;

	index index.php;

	access_log /srv/reevo-2020/log/wiki/nginx.access.log;
	error_log /srv/reevo-2020/log/wiki/nginx.error.log;

	if ($request_method !~ ^(GET|HEAD|POST)$) {
		return 405;
	}

	# Force static locations
	location = /favicon.ico {
		expires	+1y;
	}

	# Forbid access to files starting with .
	location ~ /\. {
		access_log off;
		log_not_found off;
		deny all;
	}

	# Prevent access to internal URIs
	location ^~ /(bin|docs|extensions|includes|maintenance|resources|serialized|tests)/ {
		internal;
	}

	## Uncomment after install
	# location ^~ /mw-config/ { internal; }

	# Prevent non-images in /images
	location ~* /images/.*\.[^\\/:*?\x22<>|%]+(#|\?|$) {
		types { }
		default_type text/plain;
	}

	location / {
	    # Sitio offline
    	if ($maintenance) { return 503; }

    	# Bloquea bots
		if ($limit_bots) { add_header  X-Robots-Tag "noindex, nofollow, nosnippet, noarchive"; }

    	try_files   $uri $uri/ =404;
    	error_page  404 = @mediawiki;
    	error_page  503 = @maintenance;
	}

	location @maintenance {
		# Sitio offline
		rewrite ^(.*)$ /errors/503/index.html break;
	}

	location @mediawiki {
		rewrite ^/(.*)$ /index.php?title=$1&$args	last;
	}

	location ~ \.php$ {
		fastcgi_pass unix:/srv/reevo-2020/run/wiki.socket;
		include /etc/nginx/fastcgi_params;
		fastcgi_index index.php;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
	}
}