Skip to content

Commit d74702f

Browse files
committedDec 19, 2011
Add nginx base conf, and per site conf. Still needs proxying uploads and SSL.
1 parent ec635ba commit d74702f

File tree

2 files changed

+135
-0
lines changed

2 files changed

+135
-0
lines changed
 

‎wre/var/setupfiles/nginx.conf

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
user [% wreUser %];
2+
worker_processes 10;
3+
4+
error_log [% wreRoot %]/var/logs/error.log;
5+
6+
pid [% wreRoot %]/var/run/nginx.pid;
7+
8+
events {
9+
worker_connections 1024;
10+
}
11+
12+
http {
13+
include mime.types;
14+
default_type application/octet-stream;
15+
16+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
17+
'$status $body_bytes_sent "$http_referer" '
18+
'"$http_user_agent" "$http_x_forwarded_for"';
19+
20+
sendfile on;
21+
22+
keepalive_timeout 65;
23+
24+
server_tokens off;
25+
26+
gzip on;
27+
gzip_types text/plain text/css application/json application/json-rpc application/x-javascript text/xml application/xml application/xml+rss text/javascript;
28+
gzip_comp_level 9;
29+
30+
location ^~ /extras/ {
31+
root [% webguiRoot %]/www/extras;
32+
expires 36000
33+
}
34+
35+
location ~ /.* {
36+
proxy_pass http://localhost:[% starmanPort %];
37+
}
38+
39+
server {
40+
listen [% modproxyPort %];
41+
server_name localhost;
42+
client_max_body_size 20M;
43+
proxy_set_header X-Real-IP $remote_addr;
44+
proxy_set_header Host $host;
45+
46+
}
47+
48+
##Include per-server vhost configuration files.
49+
include [% wreRoot %]/etc/*.nginx
50+
51+
}
52+

‎wre/var/setupfiles/nginx.template

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
server {
2+
listen [% modproxyPort %];
3+
server_name [% sitename %] [% domain %];
4+
access_log [% domainRoot %]/[% sitename %]/logs/access.log combined
5+
6+
# block IIS related attacks from getting to WebGUI
7+
location = /^scripts/ {
8+
return 400
9+
}
10+
11+
location = /^default.ida/ {
12+
return 400
13+
}
14+
15+
location = /_vti_bin/ {
16+
return 400
17+
}
18+
19+
location = /_mem_bin/ {
20+
return 400
21+
}
22+
23+
# leave static stuff (extras) to be served directly by modproxy (rule should be inherited from parent)
24+
#RewriteRule ^/extras/ - [L]
25+
26+
# For speed we only pass on uploads if there is a .wgaccess file
27+
RewriteCond %{REQUEST_FILENAME} ^(.*/)
28+
RewriteCond %{DOCUMENT_ROOT}%1.wgaccess !-f
29+
RewriteRule ^/uploads/ - [L]
30+
31+
# proxy webgui pages
32+
#ProxyPreserveHost On
33+
#RewriteRule ^/(.*) http://127.0.0.1:[% modperlPort %]/$1 [P]
34+
}
35+
36+
# Uncomment the following lines to enable SSL for this host. Also,
37+
# change the 10.0.0.1 to the IP address you wish to bind the SSL host
38+
# to.
39+
40+
#Listen 10.0.0.1:443
41+
#<VirtualHost 10.0.0.1:443>
42+
# ServerName [% sitename %]
43+
# CustomLog [% domainRoot %]/[% sitename %]/logs/access.log combined
44+
# DocumentRoot [% domainRoot %]/[% sitename %]/public
45+
#
46+
# # let modperl know we're using SSL
47+
# RequestHeader add SSLPROXY "1"
48+
#
49+
# # turn on mod_rewrite
50+
# RewriteEngine On
51+
# RewriteLog "[% wreRoot %]/var/logs/modrewrite.log"
52+
# RewriteLogLevel 0
53+
#
54+
# # block IIS related attacks from getting to WebGUI
55+
# RewriteRule ^/scripts/ - [L]
56+
# RewriteRule ^/default.ida - [L]
57+
# RewriteRule ^/_vti_bin - [L]
58+
# RewriteRule ^/_mem_bin - [L]
59+
#
60+
# # leave static stuff to be served directly by modproxy
61+
# RewriteRule ^/favicon.ico - [L]
62+
# RewriteRule ^/extras/ - [L]
63+
#
64+
# # For speed we only pass on uploads if there is a .wgaccess file
65+
# RewriteCond %{REQUEST_FILENAME} ^(.*/)
66+
# RewriteCond %{DOCUMENT_ROOT}%1.wgaccess !-f
67+
# RewriteRule ^/uploads/ - [L]
68+
#
69+
# # proxy webgui pages
70+
# ProxyPreserveHost On
71+
# RewriteRule ^/(.*) http://127.0.0.1:[% modperlPort %]/$1 [P]
72+
#
73+
# # enable SSL
74+
# SSLEngine on
75+
# SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
76+
# SSLCertificateFile [% domainRoot %]/[% sitename %]/certs/server.crt
77+
# SSLCertificateKeyFile [% domainRoot %]/[% sitename %]/certs/server.key
78+
# SSLCACertificateFile [% domainRoot %]/[% sitename %]/certs/UTNAddTrustServerCA.crt
79+
# SetEnvIf User-Agent ".*MSIE.*" \
80+
# nokeepalive ssl-unclean-shutdown \
81+
# downgrade-1.0 force-response-1.0
82+
#</VirtualHost>
83+

0 commit comments

Comments
 (0)
Please sign in to comment.