Newer Older
94 lines | 2.583kb
initial commit
admin cloud-section (root) authored on 2016-12-10
1
server {
2
	listen         80;
3
	server_name    cloud.paris12.pcf.fr;
4
	return         301 https://$server_name$request_uri;
5
}
6

            
7
server {
8
	listen 443 ssl;
9
	server_name cloud.paris12.pcf.fr;
10

            
11
	root /var/www/owncloud/;
12

            
13
	access_log /var/log/nginx/cloud/access.log;
14
	error_log /var/log/nginx/cloud/error.log;
15

            
16
	client_max_body_size 10G;
17
	fastcgi_buffers 64 4K;
18

            
19
	rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
20
	rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
21
	rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
22

            
23
	index index.php;
24
	error_page 403 /core/templates/403.php;
25
	error_page 404 /core/templates/404.php;
26

            
27
	ssl_certificate /etc/letsencrypt/live/cloud.paris12.pcf.fr/fullchain.pem;
28
	ssl_certificate_key /etc/letsencrypt/live/cloud.paris12.pcf.fr/privkey.pem;
29

            
30
	location = /robots.txt {
31
		deny all;
32
		log_not_found off;
33
		access_log off;
34
	}
35

            
36
	location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README){
37
		deny all;
38
	}
39

            
40
	location / {
41
                # The following 2 rules are only needed with webfinger
42
		rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
43
		rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
44

            
45
		rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
46
		rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
47

            
48
		rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
49

            
50
		try_files $uri $uri/ /index.php;
51
	}
52

            
53
	location ~ \.php(?:$|/) {
54
		fastcgi_split_path_info ^(.+\.php)(/.+)$;
55
		include fastcgi_params;
56
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
57
		fastcgi_param PATH_INFO $fastcgi_path_info;
58
		fastcgi_param HTTPS on;
59
		fastcgi_pass php-handler-cloud;
60
	}
61

            
62
    location ^~ /adminbdd {
63
        root /var/www/;
64
		auth_basic "Halte ! Qui va la ?";
65
		auth_basic_user_file /etc/nginx/htpasswd;
66
        location ~ \.php {
67
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
68
            include fastcgi_params;
69
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
70
            fastcgi_param PATH_INFO $fastcgi_path_info;
71
            fastcgi_param HTTPS on;
72
            fastcgi_pass php-handler-cloud;
73
        }
74
    }
75

            
76
	# set long EXPIRES header on static assets
77
	location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
78
		expires 30d;
79
		access_log off;
80
	}
81

            
82
	location ^~ /cartes-elections {
83
		proxy_pass http://127.0.0.1:8080;
84
		proxy_http_version 1.1;
85
		proxy_set_header Upgrade $http_upgrade;
86
		proxy_set_header Connection 'upgrade';
87
		proxy_set_header Host $host;
88
		proxy_cache_bypass $http_upgrade;
89
	}
90

            
91
	location ^~ /images/ {
92
		alias /var/www/images/;
93
	}
94
}