aboutsummaryrefslogtreecommitdiffstats
path: root/unmaintained/roundcubemail/nginx.conf
blob: 248d8d51fc7d02f34effa0addb76ae94255cd556 (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
# Sample nginx config for Roundcube.

server {
	listen 443 ssl;
	listen [::]:443 ssl;
	server_name mail.example.org;

	access_log /var/log/nginx/mail.access.log main;
	error_log /var/log/nginx/mail.error.log warn;

	#ssl_certificate /etc/ssl/acme/mail.example.org/fullchain.pem;
	#ssl_certificate_key /etc/ssl/acme/mail.example.org/privkey.pem;

	# Set max upload size. Keep in sync with memory_limit, post_max_size,
	# and upload_max_filesize in /etc/php7/php-fpm.d/roundcube.conf.
	client_max_body_size 32M;

	root /usr/share/webapps/roundcube;
	index index.php index.html;

	# Enable HSTS Policy
	#add_header Strict-Transport-Security "max-age=315360000";

	location ~ ^/(bin|SQL)/ {
		deny all;
	}

	location ~ [^/]\.php(/|$) {
		fastcgi_split_path_info ^(.+\.php)(.*)$;

		if (!-f $document_root$fastcgi_script_name) {
			return 404;
		}
		fastcgi_pass unix:/run/roundcube/fastcgi.sock;
		fastcgi_keep_conn on;
		fastcgi_index index.php;

		include fastcgi.conf;
	}

	# Allow to cache static assets.
	location ~ ^/(plugins|skins|program)/ {
		add_header Cache-Control "public, max-age=2592000";
	}
}

server {
	listen 80;
	listen [::]:80;
	server_name mail.example.org;

	# Redirect to https://.
	location / {
		rewrite ^ https://$server_name$request_uri? permanent;
	}
}