commit | author | age
|
181529
|
1 |
server { |
0ae8da
|
2 |
listen <tmpl_var name='ip_address'>:80; |
8e2c2e
|
3 |
<tmpl_if name='ipv6_enabled'> |
f2ded1
|
4 |
listen [<tmpl_var name='ipv6_address'>]:80; |
8e2c2e
|
5 |
</tmpl_if> |
0ae8da
|
6 |
|
8e2c2e
|
7 |
<tmpl_if name='ssl_enabled'> |
0ae8da
|
8 |
listen <tmpl_var name='ip_address'>:443 ssl; |
53124e
|
9 |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; |
8e2c2e
|
10 |
<tmpl_if name='ipv6_enabled'> |
f2ded1
|
11 |
listen [<tmpl_var name='ipv6_address'>]:443 ssl; |
8e2c2e
|
12 |
</tmpl_if> |
0ae8da
|
13 |
ssl_certificate <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.crt; |
F |
14 |
ssl_certificate_key <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.key; |
8e2c2e
|
15 |
</tmpl_if> |
0ae8da
|
16 |
|
F |
17 |
server_name <tmpl_var name='domain'> <tmpl_var name='alias'>; |
181529
|
18 |
|
0ae8da
|
19 |
root <tmpl_var name='web_document_root_www'>; |
f92749
|
20 |
|
8e2c2e
|
21 |
<tmpl_if name='seo_redirect_enabled'> |
bfcdef
|
22 |
if ($http_host <tmpl_var name='seo_redirect_operator'> "<tmpl_var name='seo_redirect_origin_domain'>") { |
a00888
|
23 |
rewrite ^ $scheme://<tmpl_var name='seo_redirect_target_domain'>$request_uri? permanent; |
e64fbb
|
24 |
} |
8e2c2e
|
25 |
</tmpl_if> |
bfcdef
|
26 |
<tmpl_loop name="alias_seo_redirects"> |
T |
27 |
if ($http_host <tmpl_var name='alias_seo_redirect_operator'> "<tmpl_var name='alias_seo_redirect_origin_domain'>") { |
|
28 |
rewrite ^ $scheme://<tmpl_var name='alias_seo_redirect_target_domain'>$request_uri? permanent; |
f92749
|
29 |
} |
8e2c2e
|
30 |
</tmpl_loop> |
43b345
|
31 |
<tmpl_loop name="local_redirects"> |
T |
32 |
if ($http_host <tmpl_var name='local_redirect_operator'> "<tmpl_var name='local_redirect_origin_domain'>") { |
|
33 |
rewrite ^<tmpl_var name='local_redirect_exclude'>(.*)$ <tmpl_var name='local_redirect_target'>$2 <tmpl_var name='local_redirect_type'>; |
|
34 |
} |
|
35 |
</tmpl_loop> |
bfcdef
|
36 |
|
T |
37 |
<tmpl_loop name="own_redirects"> |
|
38 |
<tmpl_if name='use_rewrite'> |
43b345
|
39 |
<tmpl_if name='exclude_own_hostname'>if ($http_host != "<tmpl_var name='exclude_own_hostname'>") { </tmpl_if>rewrite ^<tmpl_var name='rewrite_exclude'>(.*)$ <tmpl_var name='rewrite_target'>$2 <tmpl_var name='rewrite_type'>;<tmpl_if name='exclude_own_hostname'> }</tmpl_if> |
bfcdef
|
40 |
</tmpl_if> |
T |
41 |
<tmpl_if name='use_proxy'> |
|
42 |
location / { |
|
43 |
proxy_pass <tmpl_var name='rewrite_target'>; |
43b345
|
44 |
<tmpl_if name='rewrite_subdir'>rewrite ^/<tmpl_var name='rewrite_subdir'>(.*) /$1;</tmpl_if> |
bfcdef
|
45 |
<tmpl_loop name="proxy_directives"> |
T |
46 |
<tmpl_var name='proxy_directive'> |
|
47 |
</tmpl_loop> |
|
48 |
} |
|
49 |
</tmpl_if> |
|
50 |
</tmpl_loop> |
|
51 |
<tmpl_if name='use_proxy' op='!=' value='y'> |
3c12a4
|
52 |
index index.html index.htm index.php index.cgi index.pl index.xhtml; |
0ae8da
|
53 |
|
8e2c2e
|
54 |
<tmpl_if name='ssi' op='==' value='y'> |
0ae8da
|
55 |
location ~ \.shtml$ { |
F |
56 |
ssi on; |
|
57 |
} |
8e2c2e
|
58 |
</tmpl_if> |
0ae8da
|
59 |
|
8e2c2e
|
60 |
<tmpl_if name='errordocs'> |
0ae8da
|
61 |
error_page 400 /error/400.html; |
F |
62 |
error_page 401 /error/401.html; |
|
63 |
error_page 403 /error/403.html; |
|
64 |
error_page 404 /error/404.html; |
|
65 |
error_page 405 /error/405.html; |
|
66 |
error_page 500 /error/500.html; |
445513
|
67 |
error_page 502 /error/502.html; |
0ae8da
|
68 |
error_page 503 /error/503.html; |
b67344
|
69 |
recursive_error_pages on; |
T |
70 |
location = /error/400.html { |
bfcdef
|
71 |
<tmpl_var name='web_document_root_www_proxy'> |
b67344
|
72 |
internal; |
T |
73 |
} |
|
74 |
location = /error/401.html { |
bfcdef
|
75 |
<tmpl_var name='web_document_root_www_proxy'> |
b67344
|
76 |
internal; |
T |
77 |
} |
|
78 |
location = /error/403.html { |
bfcdef
|
79 |
<tmpl_var name='web_document_root_www_proxy'> |
b67344
|
80 |
internal; |
T |
81 |
} |
|
82 |
location = /error/404.html { |
bfcdef
|
83 |
<tmpl_var name='web_document_root_www_proxy'> |
b67344
|
84 |
internal; |
T |
85 |
} |
|
86 |
location = /error/405.html { |
bfcdef
|
87 |
<tmpl_var name='web_document_root_www_proxy'> |
b67344
|
88 |
internal; |
T |
89 |
} |
|
90 |
location = /error/500.html { |
bfcdef
|
91 |
<tmpl_var name='web_document_root_www_proxy'> |
b67344
|
92 |
internal; |
T |
93 |
} |
|
94 |
location = /error/502.html { |
bfcdef
|
95 |
<tmpl_var name='web_document_root_www_proxy'> |
b67344
|
96 |
internal; |
T |
97 |
} |
|
98 |
location = /error/503.html { |
bfcdef
|
99 |
<tmpl_var name='web_document_root_www_proxy'> |
b67344
|
100 |
internal; |
T |
101 |
} |
8e2c2e
|
102 |
</tmpl_if> |
0ae8da
|
103 |
|
F |
104 |
error_log /var/log/ispconfig/httpd/<tmpl_var name='domain'>/error.log; |
b6a10a
|
105 |
access_log /var/log/ispconfig/httpd/<tmpl_var name='domain'>/access.log combined; |
0ae8da
|
106 |
|
F |
107 |
## Disable .htaccess and other hidden files |
|
108 |
location ~ /\. { |
|
109 |
deny all; |
|
110 |
access_log off; |
|
111 |
log_not_found off; |
181529
|
112 |
} |
0ae8da
|
113 |
|
3c12a4
|
114 |
location = /favicon.ico { |
0ae8da
|
115 |
log_not_found off; |
F |
116 |
access_log off; |
|
117 |
} |
|
118 |
|
|
119 |
location = /robots.txt { |
|
120 |
allow all; |
|
121 |
log_not_found off; |
|
122 |
access_log off; |
|
123 |
} |
|
124 |
|
992797
|
125 |
location /stats/ { |
bfcdef
|
126 |
<tmpl_var name='web_document_root_www_proxy'> |
0ae8da
|
127 |
index index.html index.php; |
F |
128 |
auth_basic "Members Only"; |
|
129 |
auth_basic_user_file <tmpl_var name='stats_auth_passwd_file'>; |
|
130 |
} |
|
131 |
|
b67344
|
132 |
location ^~ /awstats-icon { |
8cf78b
|
133 |
alias /usr/share/awstats/icon; |
T |
134 |
} |
|
135 |
|
0ae8da
|
136 |
location ~ \.php$ { |
c8c13a
|
137 |
try_files <tmpl_var name='rnd_php_dummy_file'> @php; |
e19c2e
|
138 |
} |
F |
139 |
|
|
140 |
<tmpl_if name='php' op='==' value='php-fpm'> |
|
141 |
location @php { |
f92749
|
142 |
try_files $uri =404; |
ad9986
|
143 |
include /etc/nginx/fastcgi_params; |
8e2c2e
|
144 |
<tmpl_if name='use_tcp'> |
F |
145 |
fastcgi_pass 127.0.0.1:<tmpl_var name='fpm_port'>; |
|
146 |
</tmpl_if> |
|
147 |
<tmpl_if name='use_socket'> |
|
148 |
fastcgi_pass unix:<tmpl_var name='fpm_socket'>; |
|
149 |
</tmpl_if> |
0ae8da
|
150 |
fastcgi_index index.php; |
F |
151 |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
43b345
|
152 |
#fastcgi_param PATH_INFO $fastcgi_script_name; |
ad9986
|
153 |
fastcgi_intercept_errors on; |
0ae8da
|
154 |
} |
8e2c2e
|
155 |
</tmpl_else> |
e19c2e
|
156 |
location @php { |
0ae8da
|
157 |
deny all; |
F |
158 |
} |
8e2c2e
|
159 |
</tmpl_if> |
0ae8da
|
160 |
|
8e2c2e
|
161 |
<tmpl_if name='cgi' op='==' value='y'> |
0ae8da
|
162 |
location /cgi-bin/ { |
f92749
|
163 |
try_files $uri =404; |
ad9986
|
164 |
include /etc/nginx/fastcgi_params; |
0ae8da
|
165 |
root <tmpl_var name='document_root'>; |
F |
166 |
gzip off; |
|
167 |
fastcgi_pass unix:/var/run/fcgiwrap.socket; |
|
168 |
fastcgi_index index.cgi; |
|
169 |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
ad9986
|
170 |
fastcgi_intercept_errors on; |
0ae8da
|
171 |
} |
8e2c2e
|
172 |
</tmpl_if> |
181529
|
173 |
|
615a0a
|
174 |
<tmpl_loop name="rewrite_rules"> |
T |
175 |
<tmpl_var name='rewrite_rule'> |
|
176 |
</tmpl_loop> |
|
177 |
|
8e2c2e
|
178 |
<tmpl_loop name="nginx_directives"> |
3c12a4
|
179 |
<tmpl_var name='nginx_directive'> |
8ab3cd
|
180 |
</tmpl_loop> |
T |
181 |
|
|
182 |
<tmpl_loop name="basic_auth_locations"> |
9b16a3
|
183 |
location <tmpl_var name='htpasswd_location'> { ##merge## |
8ab3cd
|
184 |
auth_basic "Members Only"; |
T |
185 |
auth_basic_user_file <tmpl_var name='htpasswd_path'>.htpasswd; |
e19c2e
|
186 |
|
F |
187 |
location ~ \.php$ { |
53f048
|
188 |
try_files <tmpl_var name='rnd_php_dummy_file'> @php; |
e19c2e
|
189 |
} |
8ab3cd
|
190 |
} |
T |
191 |
</tmpl_loop> |
bfcdef
|
192 |
</tmpl_if> |
T |
193 |
} |
|
194 |
|
|
195 |
<tmpl_loop name="redirects"> |
|
196 |
server { |
|
197 |
listen <tmpl_var name='ip_address'>:80; |
|
198 |
<tmpl_if name='ipv6_enabled'> |
|
199 |
listen [<tmpl_var name='ipv6_address'>]:80; |
|
200 |
</tmpl_if> |
|
201 |
|
|
202 |
<tmpl_if name='ssl_enabled'> |
|
203 |
listen <tmpl_var name='ip_address'>:443 ssl; |
|
204 |
<tmpl_if name='ipv6_enabled'> |
|
205 |
listen [<tmpl_var name='ipv6_address'>]:443 ssl; |
|
206 |
</tmpl_if> |
|
207 |
ssl_certificate <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.crt; |
|
208 |
ssl_certificate_key <tmpl_var name='document_root'>/ssl/<tmpl_var name='ssl_domain'>.key; |
|
209 |
</tmpl_if> |
|
210 |
|
|
211 |
server_name <tmpl_var name='rewrite_domain'>; |
|
212 |
<tmpl_if name='alias_seo_redirects2'> |
|
213 |
<tmpl_loop name="alias_seo_redirects2"> |
|
214 |
if ($http_host <tmpl_var name='alias_seo_redirect_operator'> "<tmpl_var name='alias_seo_redirect_origin_domain'>") { |
|
215 |
rewrite ^ $scheme://<tmpl_var name='alias_seo_redirect_target_domain'>$request_uri? permanent; |
|
216 |
} |
|
217 |
</tmpl_loop> |
|
218 |
</tmpl_if> |
|
219 |
<tmpl_if name='use_rewrite'> |
|
220 |
rewrite ^ <tmpl_var name='rewrite_target'>$request_uri? <tmpl_var name='rewrite_type'>; |
|
221 |
</tmpl_if> |
|
222 |
<tmpl_if name='use_proxy'> |
|
223 |
location / { |
|
224 |
proxy_pass <tmpl_var name='rewrite_target'>; |
43b345
|
225 |
<tmpl_if name='rewrite_subdir'>rewrite ^/<tmpl_var name='rewrite_subdir'>(.*) /$1;</tmpl_if> |
bfcdef
|
226 |
<tmpl_loop name="proxy_directives"> |
T |
227 |
<tmpl_var name='proxy_directive'> |
|
228 |
</tmpl_loop> |
|
229 |
} |
|
230 |
</tmpl_if> |
|
231 |
} |
|
232 |
</tmpl_loop> |