File tree Expand file tree Collapse file tree 3 files changed +52
-1
lines changed
Expand file tree Collapse file tree 3 files changed +52
-1
lines changed Original file line number Diff line number Diff line change @@ -2226,7 +2226,10 @@ public function configure_apps_vhost() {
22262226 $ tpl ->setVar ('logging ' ,'yes ' );
22272227 }
22282228
2229-
2229+ if ($ conf ['rspamd ' ]['installed ' ] == true ) {
2230+ $ tpl ->setVar ('use_rspamd ' , 'yes ' );
2231+ }
2232+
22302233 // comment out the listen directive if port is 80 or 443
22312234 if ($ conf ['web ' ]['apps_vhost_ip ' ] == 80 or $ conf ['web ' ]['apps_vhost_ip ' ] == 443 ) {
22322235 $ tpl ->setVar ('vhost_port_listen ' ,'# ' );
@@ -2294,6 +2297,12 @@ public function configure_apps_vhost() {
22942297 $ apps_vhost_ip = $ conf ['web ' ]['apps_vhost_ip ' ].': ' ;
22952298 }
22962299
2300+ if ($ conf ['rspamd ' ]['installed ' ] == true ) {
2301+ $ content = str_replace ('{use_rspamd} ' , '' , $ content );
2302+ } else {
2303+ $ content = str_replace ('{use_rspamd} ' , '# ' , $ content );
2304+ }
2305+
22972306 $ socket_dir = escapeshellcmd ($ conf ['nginx ' ]['php_fpm_socket_dir ' ]);
22982307 if (substr ($ socket_dir , -1 ) != '/ ' ) $ socket_dir .= '/ ' ;
22992308 if (!is_dir ($ socket_dir )) exec ('mkdir -p ' .$ socket_dir );
Original file line number Diff line number Diff line change 1919 RequestHeader unset Proxy early
2020 </IfModule>
2121
22+ {tmpl_if name="enable_spdy" op="==" value="y"}
23+ <IfModule spdy_module>
24+ SpdyEnabled on
25+ </IfModule>
26+ {/tmpl_if}
27+
2228 <IfModule mod_php5.c>
2329 DocumentRoot {tmpl_var name='apps_vhost_dir'}
2430 AddType application/x-httpd-php .php
6874 </Directory>
6975 </IfModule>
7076
77+ {tmpl_if name="use_rspamd"}
78+ <Location /rspamd>
79+ Order allow,deny
80+ Allow from all
81+ </Location>
82+ RewriteEngine On
83+ RewriteRule ^/rspamd$ /rspamd/ [R,L]
84+ RewriteRule ^/rspamd/(.*) http://127.0.0.1:11334/$1 [P]
85+ {/tmpl_if}
86+
87+
88+
7189</VirtualHost>
7290
7391
Original file line number Diff line number Diff line change @@ -208,4 +208,28 @@ server {
208208 alias /var/lib/mailman/archives/public;
209209 autoindex on;
210210 }
211+
212+ {use_rspamd}location /rspamd/ {
213+ {use_rspamd}proxy_pass http://127.0.0.1:11334/;
214+ {use_rspamd}rewrite ^//(.*) /$1;
215+ {use_rspamd}proxy_set_header X-Forwarded-Proto $scheme;
216+ {use_rspamd}proxy_set_header Host $host;
217+ {use_rspamd}proxy_set_header X-Real-IP $remote_addr;
218+ {use_rspamd}proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
219+ {use_rspamd}proxy_pass_header Authorization;
220+ {use_rspamd}client_max_body_size 0;
221+ {use_rspamd}client_body_buffer_size 1m;
222+ {use_rspamd}proxy_intercept_errors on;
223+ {use_rspamd}proxy_buffering on;
224+ {use_rspamd}proxy_buffer_size 128k;
225+ {use_rspamd}proxy_buffers 256 16k;
226+ {use_rspamd}proxy_busy_buffers_size 256k;
227+ {use_rspamd}proxy_temp_file_write_size 256k;
228+ {use_rspamd}proxy_max_temp_file_size 0;
229+ {use_rspamd}proxy_read_timeout 300;
230+ {use_rspamd}
231+ {use_rspamd}location ~* ^/rspamd/(.+\.(jpg|jpeg|gif|css|png|js|ico|html?|xml|txt))$ {
232+ {use_rspamd}alias /usr/share/rspamd/www/$1;
233+ {use_rspamd}}
234+ {use_rspamd}}
211235}
You can’t perform that action at this time.
0 commit comments