Ticket #54: website.conf

File website.conf, 9.4 KB (added by www.google.com/accounts/o8/id?id=AItOawlrkCvTFNQql78chIYueQX_3DBjOlJsesQ, 14 years ago)

and another one from include dir

Line 
1fastcgi_cache_path /var/tmp/nginx/fastcgi_cache_website levels=1:2 keys_zone=website:20m max_size=512m inactive=7d;
2
3server {
4 listen 192.168.10.80:80;
5 listen 192.168.10.80:443;
6 server_name website.com.ua;
7 access_log off;
8 error_log off;
9 rewrite ^ http://www.website.com.ua$request_uri permanent;
10}
11
12server {
13 listen 192.168.10.80:80;
14 server_name www.website.com.ua;
15
16 allow all;
17
18 access_log /home/website/logs/website.com.ua_access.log main;
19 error_log /home/website/logs/website.com.ua_error.log notice;
20
21 client_max_body_size 20m;
22 client_body_buffer_size 128k;
23 client_body_temp_path /home/website/tmp/client_body_temp;
24
25 root /home/website/docroot/web;
26 index index.php;
27
28 fastcgi_cache_key $request_method$host$uri$is_args$args;
29 fastcgi_intercept_errors on;
30 fastcgi_index index.php;
31 fastcgi_send_timeout 180;
32 fastcgi_read_timeout 180;
33 fastcgi_buffer_size 128k;
34 fastcgi_buffers 4 256k;
35 fastcgi_busy_buffers_size 256k;
36 fastcgi_temp_file_write_size 256k;
37
38 location = /favicon.ico {
39 log_not_found off;
40 access_log off;
41 }
42
43 location = /robots.txt {
44 allow all;
45 log_not_found off;
46 # access_log off;
47 }
48
49 location ~ /\.ht {
50 deny all;
51 }
52
53 location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|xz|lzma|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|wmv|flv|fla|swf|bmp|rtf|js)$ {
54 expires max;
55 }
56
57 location = / {
58 try_files /maintenance.html $uri @rewrite_nc;
59 }
60
61 location / {
62 try_files /maintenance.html $uri @rewrite_nc;
63 }
64
65 location ~ ^/backend.php {
66 rewrite ^(.*) https://$host$1 permanent;
67 }
68
69 location ~* feedback$ {
70 try_files /maintenance.html $uri @rewrite_nc;
71 }
72
73 location ~* (pidpiska|podpiska|subscribe)$ {
74 try_files /maintenance.html $uri @rewrite_nc;
75 }
76
77 location ~* ^/captcha {
78 try_files /maintenance.html $uri @rewrite_nc;
79 }
80
81 location ~* ^/(uk|ru|en) {
82 try_files /maintenance.html $uri @rewrite;
83 }
84
85 location @rewrite {
86 set $cache 1;
87 rewrite ^/(.*)$ /index.php?symphony-page=$1 last;
88 }
89
90 location @rewrite_nc {
91 set $cache 0;
92 rewrite ^/(.*)$ /index.php?symphony-page=$1 last;
93 }
94
95 location ~ \.php$ {
96 if ($cache) {
97 error_page 418 = @symphony;
98 return 418;
99 }
100 error_page 418 = @symphony_nc;
101 return 418;
102 }
103
104 location @symphony_nc {
105 include fastcgi_params;
106 fastcgi_cache off;
107 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
108 fastcgi_pass unix:/home/website/tmp/php-fpm_website.sock;
109 }
110
111 location @symphony {
112 include fastcgi_params;
113 fastcgi_hide_header "Set-Cookie";
114 fastcgi_ignore_headers Cache-Control Expires X-Accel-Redirect X-Accel-Expires Set-Cookie;
115 fastcgi_cache website;
116 fastcgi_cache_valid 200 302 20m;
117 fastcgi_cache_valid 301 1h;
118 fastcgi_cache_valid 404 502 1m;
119 fastcgi_cache_valid 503 4s;
120 fastcgi_cache_valid any 1h;
121 fastcgi_cache_use_stale error timeout invalid_header updating http_500 http_503;
122 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
123 fastcgi_pass unix:/home/website/tmp/php-fpm_website.sock;
124 }
125}
126
127server {
128 listen 192.168.10.80:443;
129
130 server_name www.website.com.ua;
131
132 allow all;
133
134 ssl on;
135 ssl_certificate /usr/local/etc/ssl/httpd/crt/website.com.ua.crt;
136 ssl_certificate_key /usr/local/etc/ssl/httpd/key/server.key;
137
138 access_log /home/website/logs/website.com.ua_access.log main;
139 error_log /home/website/logs/website.com.ua_error.log notice;
140
141 client_max_body_size 20m;
142 client_body_buffer_size 128k;
143 client_body_temp_path /home/website/tmp/client_body_temp;
144
145 root /home/website/docroot/web;
146 index index.php;
147
148 fastcgi_cache_key $request_method$host$uri$is_args$args;
149 fastcgi_intercept_errors on;
150 fastcgi_index index.php;
151 fastcgi_send_timeout 180;
152 fastcgi_read_timeout 180;
153 fastcgi_buffer_size 128k;
154 fastcgi_buffers 4 256k;
155 fastcgi_busy_buffers_size 256k;
156 fastcgi_temp_file_write_size 256k;
157
158 location = /favicon.ico {
159 log_not_found off;
160 access_log off;
161 }
162
163 location = /robots.txt {
164 allow all;
165 log_not_found off;
166 }
167
168 location ~ /\.ht {
169 deny all;
170 }
171
172 location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|xz|lzma|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|wmv|flv|fla|swf|bmp|rtf|js)$ {
173 expires max;
174 }
175
176 location = / {
177 try_files /maintenance.html $uri @rewrite_nc;
178 }
179
180 location / {
181 try_files /maintenance.html $uri @rewrite_nc;
182 }
183
184 location ~* feedback$ {
185 try_files /maintenance.html $uri @rewrite_nc;
186 }
187
188 location ~* (pidpiska|podpiska|subscribe)$ {
189 try_files /maintenance.html $uri @rewrite_nc;
190 }
191
192 location ~* ^/captcha {
193 try_files /maintenance.html $uri @rewrite_nc;
194 }
195
196 location ~* ^/(uk|ru|en) {
197 try_files /maintenance.html $uri @rewrite;
198 }
199
200 location @rewrite {
201 set $cache 1;
202 rewrite ^/(.*)$ /index.php?symphony-page=$1 last;
203 }
204
205 location @rewrite_nc {
206 set $cache 0;
207 rewrite ^/(.*)$ /index.php?symphony-page=$1 last;
208 }
209
210 location ~ \.php$ {
211 if ($cache) {
212 error_page 418 = @symphony;
213 return 418;
214 }
215 error_page 418 = @symphony_nc;
216 return 418;
217 }
218
219 location ~ ^/backend.php {
220 rewrite ^/(.*)$ /backend.php?symphony-page=$1&mode=administration last;
221 error_page 418 = @symphony_nc;
222 return 418;
223 }
224
225 location @symphony_nc {
226 include fastcgi_params;
227 fastcgi_cache off;
228 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
229 fastcgi_param HTTPS on;
230 fastcgi_pass unix:/home/website/tmp/php-fpm_website.sock;
231 }
232
233 location @symphony {
234 include fastcgi_params;
235 fastcgi_hide_header "Set-Cookie";
236 fastcgi_ignore_headers Cache-Control Expires X-Accel-Redirect X-Accel-Expires Set-Cookie;
237 fastcgi_cache website;
238 fastcgi_cache_valid 200 302 20m;
239 fastcgi_cache_valid 301 1h;
240 fastcgi_cache_valid 404 502 1m;
241 fastcgi_cache_valid 503 4s;
242 fastcgi_cache_valid any 1h;
243 fastcgi_cache_use_stale error timeout invalid_header updating http_500 http_503;
244 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
245 fastcgi_param HTTPS on;
246 fastcgi_pass unix:/home/website/tmp/php-fpm_website.sock;
247 }
248}