site.conf 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. proxy_cache_path /tmp levels=1:2 keys_zone=sogo:10m inactive=24h max_size=1g;
  2. map $http_x_forwarded_proto $client_req_scheme {
  3. default $scheme;
  4. https https;
  5. }
  6. server {
  7. include /etc/nginx/conf.d/listen_ssl.active;
  8. include /etc/nginx/mime.types;
  9. charset utf-8;
  10. override_charset on;
  11. ssl on;
  12. ssl_certificate /etc/ssl/mail/cert.pem;
  13. ssl_certificate_key /etc/ssl/mail/key.pem;
  14. ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  15. ssl_prefer_server_ciphers on;
  16. ssl_ciphers 'EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA256:EECDH:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!IDEA:!ECDSA:kEDH:CAMELLIA128-SHA:AES128-SHA';
  17. add_header Strict-Transport-Security "max-age=15768000; includeSubDomains";
  18. ssl_ecdh_curve secp384r1;
  19. index index.php index.html;
  20. include /etc/nginx/conf.d/server_name.active;
  21. error_log /var/log/nginx/error.log;
  22. access_log /var/log/nginx/access.log;
  23. absolute_redirect off;
  24. root /web;
  25. location ~ ^/api/v1/(.*)$ {
  26. try_files $uri $uri/ /json_api.php?query=$1;
  27. }
  28. location ^~ /.well-known/acme-challenge/ {
  29. allow all;
  30. default_type "text/plain";
  31. }
  32. # If behind reverse proxy, forwards the correct IP
  33. set_real_ip_from 172.22.1.1;
  34. real_ip_header X-Forwarded-For;
  35. real_ip_recursive on;
  36. rewrite ^/.well-known/caldav$ /SOGo/dav/ permanent;
  37. rewrite ^/.well-known/carddav$ /SOGo/dav/ permanent;
  38. location ^~ /principals {
  39. return 301 /SOGo/dav;
  40. }
  41. location ~ \.php$ {
  42. try_files $uri =404;
  43. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  44. fastcgi_pass phpfpm:9000;
  45. fastcgi_index index.php;
  46. include /etc/nginx/fastcgi_params;
  47. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  48. fastcgi_param PATH_INFO $fastcgi_path_info;
  49. fastcgi_param PHP_VALUE "max_execution_time = 1200
  50. max_input_time = 1200
  51. memory_limit = 64M";
  52. fastcgi_read_timeout 1200;
  53. }
  54. location /rspamd/ {
  55. proxy_pass http://172.22.1.253:11334/;
  56. proxy_set_header Host $http_host;
  57. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  58. proxy_set_header X-Real-IP $remote_addr;
  59. proxy_redirect off;
  60. }
  61. location ~* ^/Autodiscover/Autodiscover.xml {
  62. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  63. fastcgi_pass phpfpm:9000;
  64. include /etc/nginx/fastcgi_params;
  65. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  66. try_files /autodiscover.php =404;
  67. }
  68. location ~ /(?:m|M)ail/(?:c|C)onfig-v1.1.xml {
  69. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  70. fastcgi_pass phpfpm:9000;
  71. include /etc/nginx/fastcgi_params;
  72. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  73. try_files /autoconfig.php =404;
  74. }
  75. location ^~ /Microsoft-Server-ActiveSync {
  76. proxy_pass http://172.22.1.252:20000/SOGo/Microsoft-Server-ActiveSync;
  77. proxy_connect_timeout 1000;
  78. proxy_next_upstream timeout error;
  79. proxy_send_timeout 1000;
  80. proxy_read_timeout 1000;
  81. proxy_buffer_size 8k;
  82. proxy_buffers 4 32k;
  83. proxy_temp_file_write_size 64k;
  84. proxy_busy_buffers_size 64k;
  85. proxy_set_header X-Real-IP $remote_addr;
  86. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  87. proxy_set_header Host $http_host;
  88. proxy_set_header x-webobjects-server-protocol HTTP/1.0;
  89. proxy_set_header x-webobjects-remote-host $remote_addr;
  90. proxy_set_header x-webobjects-server-name $server_name;
  91. proxy_set_header x-webobjects-server-url $client_req_scheme://$http_host;
  92. proxy_set_header x-webobjects-server-port $server_port;
  93. client_body_buffer_size 128k;
  94. client_max_body_size 100m;
  95. }
  96. location ^~ /SOGo {
  97. proxy_pass http://172.22.1.252:20000;
  98. proxy_set_header X-Real-IP $remote_addr;
  99. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  100. proxy_set_header Host $http_host;
  101. proxy_set_header x-webobjects-server-protocol HTTP/1.0;
  102. proxy_set_header x-webobjects-remote-host $remote_addr;
  103. proxy_set_header x-webobjects-server-name $server_name;
  104. proxy_set_header x-webobjects-server-url $client_req_scheme://$http_host;
  105. proxy_set_header x-webobjects-server-port $server_port;
  106. client_body_buffer_size 128k;
  107. client_max_body_size 100m;
  108. break;
  109. }
  110. location /SOGo.woa/WebServerResources/ {
  111. proxy_pass http://172.22.1.252:9192/WebServerResources/;
  112. proxy_set_header Host $http_host;
  113. proxy_cache sogo;
  114. proxy_cache_valid 200 1d;
  115. proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
  116. #alias /usr/lib/GNUstep/SOGo/WebServerResources/;
  117. allow all;
  118. }
  119. location /.woa/WebServerResources/ {
  120. proxy_pass http://172.22.1.252:9192/WebServerResources/;
  121. proxy_set_header Host $http_host;
  122. proxy_cache sogo;
  123. proxy_cache_valid 200 1d;
  124. proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
  125. #alias /usr/lib/GNUstep/SOGo/WebServerResources/;
  126. allow all;
  127. }
  128. location /SOGo/WebServerResources/ {
  129. proxy_pass http://172.22.1.252:9192/WebServerResources/;
  130. proxy_set_header Host $http_host;
  131. proxy_cache sogo;
  132. proxy_cache_valid 200 1d;
  133. proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
  134. #alias /usr/lib/GNUstep/SOGo/WebServerResources/;
  135. allow all;
  136. }
  137. location (^/SOGo/so/ControlPanel/Products/[^/]*UI/Resources/.*\.(jpg|png|gif|css|js)$ {
  138. proxy_pass http://172.22.1.252:9192/$1.SOGo/Resources/$2;
  139. proxy_set_header Host $http_host;
  140. proxy_cache sogo;
  141. proxy_cache_valid 200 1d;
  142. proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
  143. #alias /usr/lib/GNUstep/SOGo/$1.SOGo/Resources/$2;
  144. }
  145. }
  146. server {
  147. include /etc/nginx/conf.d/listen_plain.active;
  148. include /etc/nginx/mime.types;
  149. charset utf-8;
  150. override_charset on;
  151. index index.php index.html;
  152. include /etc/nginx/conf.d/server_name.active;
  153. error_log /var/log/nginx/error.log;
  154. access_log /var/log/nginx/access.log;
  155. absolute_redirect off;
  156. root /web;
  157. location ~ ^/api/v1/(.*)$ {
  158. try_files $uri $uri/ /json_api.php?query=$1;
  159. }
  160. location ^~ /.well-known/acme-challenge/ {
  161. allow all;
  162. default_type "text/plain";
  163. }
  164. # If behind reverse proxy, forwards the correct IP
  165. set_real_ip_from 172.22.1.1;
  166. real_ip_header X-Forwarded-For;
  167. real_ip_recursive on;
  168. rewrite ^/.well-known/caldav$ /SOGo/dav/ permanent;
  169. rewrite ^/.well-known/carddav$ /SOGo/dav/ permanent;
  170. location ^~ /principals {
  171. return 301 /SOGo/dav;
  172. }
  173. location ~ \.php$ {
  174. try_files $uri =404;
  175. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  176. fastcgi_pass phpfpm:9000;
  177. fastcgi_index index.php;
  178. include /etc/nginx/fastcgi_params;
  179. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  180. fastcgi_param PATH_INFO $fastcgi_path_info;
  181. fastcgi_param PHP_VALUE "max_execution_time = 1200
  182. max_input_time = 1200
  183. memory_limit = 64M";
  184. fastcgi_read_timeout 1200;
  185. }
  186. location /rspamd/ {
  187. proxy_pass http://172.22.1.253:11334/;
  188. proxy_set_header Host $http_host;
  189. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  190. proxy_set_header X-Real-IP $remote_addr;
  191. proxy_redirect off;
  192. }
  193. location ~* ^/Autodiscover/Autodiscover.xml {
  194. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  195. fastcgi_pass phpfpm:9000;
  196. include /etc/nginx/fastcgi_params;
  197. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  198. try_files /autodiscover.php =404;
  199. }
  200. location ~ /(?:m|M)ail/(?:c|C)onfig-v1.1.xml {
  201. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  202. fastcgi_pass phpfpm:9000;
  203. include /etc/nginx/fastcgi_params;
  204. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  205. try_files /autoconfig.php =404;
  206. }
  207. location ^~ /Microsoft-Server-ActiveSync {
  208. proxy_pass http://172.22.1.252:20000/SOGo/Microsoft-Server-ActiveSync;
  209. proxy_connect_timeout 1000;
  210. proxy_next_upstream timeout error;
  211. proxy_send_timeout 1000;
  212. proxy_read_timeout 1000;
  213. proxy_buffer_size 8k;
  214. proxy_buffers 4 32k;
  215. proxy_temp_file_write_size 64k;
  216. proxy_busy_buffers_size 64k;
  217. proxy_set_header X-Real-IP $remote_addr;
  218. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  219. proxy_set_header Host $http_host;
  220. proxy_set_header x-webobjects-server-protocol HTTP/1.0;
  221. proxy_set_header x-webobjects-remote-host $remote_addr;
  222. proxy_set_header x-webobjects-server-name $server_name;
  223. proxy_set_header x-webobjects-server-url $client_req_scheme://$http_host;
  224. proxy_set_header x-webobjects-server-port $server_port;
  225. client_body_buffer_size 128k;
  226. client_max_body_size 100m;
  227. }
  228. location ^~ /SOGo {
  229. proxy_pass http://172.22.1.252:20000;
  230. proxy_set_header X-Real-IP $remote_addr;
  231. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  232. proxy_set_header Host $http_host;
  233. proxy_set_header x-webobjects-server-protocol HTTP/1.0;
  234. proxy_set_header x-webobjects-remote-host $remote_addr;
  235. proxy_set_header x-webobjects-server-name $server_name;
  236. proxy_set_header x-webobjects-server-url $client_req_scheme://$http_host;
  237. proxy_set_header x-webobjects-server-port $server_port;
  238. client_body_buffer_size 128k;
  239. client_max_body_size 100m;
  240. break;
  241. }
  242. location /SOGo.woa/WebServerResources/ {
  243. proxy_pass http://172.22.1.252:9192/WebServerResources/;
  244. proxy_set_header Host $http_host;
  245. proxy_cache sogo;
  246. proxy_cache_valid 200 1d;
  247. proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
  248. #alias /usr/lib/GNUstep/SOGo/WebServerResources/;
  249. allow all;
  250. }
  251. location /.woa/WebServerResources/ {
  252. proxy_pass http://172.22.1.252:9192/WebServerResources/;
  253. proxy_set_header Host $http_host;
  254. proxy_cache sogo;
  255. proxy_cache_valid 200 1d;
  256. proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
  257. #alias /usr/lib/GNUstep/SOGo/WebServerResources/;
  258. allow all;
  259. }
  260. location /SOGo/WebServerResources/ {
  261. proxy_pass http://172.22.1.252:9192/WebServerResources/;
  262. proxy_set_header Host $http_host;
  263. proxy_cache sogo;
  264. proxy_cache_valid 200 1d;
  265. proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
  266. #alias /usr/lib/GNUstep/SOGo/WebServerResources/;
  267. allow all;
  268. }
  269. location (^/SOGo/so/ControlPanel/Products/[^/]*UI/Resources/.*\.(jpg|png|gif|css|js)$ {
  270. proxy_pass http://172.22.1.252:9192/$1.SOGo/Resources/$2;
  271. proxy_set_header Host $http_host;
  272. proxy_cache sogo;
  273. proxy_cache_valid 200 1d;
  274. proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
  275. #alias /usr/lib/GNUstep/SOGo/$1.SOGo/Resources/$2;
  276. }
  277. }