Skip to content

Commit 8e2d764

Browse files
committed
Refresh sample nginx vhost configuration with prod
1 parent 5fd054b commit 8e2d764

File tree

1 file changed

+63
-54
lines changed

1 file changed

+63
-54
lines changed

etc/nginx-vhost-sample.conf

Lines changed: 63 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#
22
# BNETDocs, the Battle.net(TM) protocol documentation and discussion website
3-
# Copyright (C) 2008-2016 Carl Bennett
3+
# Copyright (C) 2008-2020 "Arta", Don Cullen "Kyro", Carl Bennett, others
44
# This file is part of BNETDocs.
55
#
66
# BNETDocs is free software: you can redistribute it and/or modify
@@ -20,87 +20,96 @@
2020
# It is NOT intended to be used in place of your actual configuration.
2121
#
2222
server {
23+
listen 80;
24+
listen [::]:80;
25+
server_name bnetdocs.org;
2326

24-
listen 80;
25-
listen [::]:80;
26-
server_name bnetdocs.org;
27-
28-
include conf.d/error-pages.conf;
29-
include conf.d/gzip.conf;
30-
include conf.d/url-filter*.conf;
27+
include conf.d/error-pages.conf;
28+
include conf.d/gzip.conf;
29+
include conf.d/url-filter*.conf;
3130

3231
location / {
33-
return 301 https://$host$uri$is_args$args;
32+
return 301 https://$host$request_uri;
3433
}
35-
3634
}
3735
server {
36+
ssl_certificate /etc/letsencrypt/live/bnetdocs.org/fullchain.pem; # managed by Certbot
37+
ssl_certificate_key /etc/letsencrypt/live/bnetdocs.org/privkey.pem; # managed by Certbot
3838

39-
ssl_certificate sites-certs/bnetdocs-www.crt;
40-
ssl_certificate_key sites-certs/bnetdocs-www.key;
41-
42-
listen 80;
43-
listen [::]:80;
44-
listen 443 ssl http2;
45-
listen [::]:443 ssl http2;
46-
server_name .www.bnetdocs.org;
39+
listen 80;
40+
listen [::]:80;
41+
listen 443 ssl http2;
42+
listen [::]:443 ssl http2;
43+
server_name www.bnetdocs.org;
4744

48-
include conf.d/error-pages.conf;
49-
include conf.d/gzip.conf;
50-
include conf.d/url-filter*.conf;
45+
include conf.d/error-pages.conf;
46+
include conf.d/url-filter*.conf;
5147

5248
location / {
53-
return 301 https://bnetdocs.org$uri$is_args$args;
49+
return 301 https://bnetdocs.org$request_uri;
5450
}
5551
}
5652
map $sent_http_content_type $bnetdocs_expires {
57-
default off;
58-
~application/ 1y;
59-
~image/ 1y;
60-
~text/ 1y;
61-
~video/ 1y;
53+
default off;
54+
~application/ 1y;
55+
~image/ 1y;
56+
~text/ 1y;
57+
~video/ 1y;
6258
}
6359
server {
60+
ssl_certificate /etc/letsencrypt/live/bnetdocs.org/fullchain.pem; # managed by Certbot
61+
ssl_certificate_key /etc/letsencrypt/live/bnetdocs.org/privkey.pem; # managed by Certbot
6462

65-
ssl_certificate sites-certs/bnetdocs-www.crt;
66-
ssl_certificate_key sites-certs/bnetdocs-www.key;
63+
listen 443 ssl http2;
64+
listen [::]:443 ssl http2;
65+
server_name bnetdocs.org;
6766

68-
listen 443 ssl http2;
69-
listen [::]:443 ssl http2;
70-
server_name bnetdocs.org;
67+
include conf.d/error-pages.conf;
68+
include conf.d/url-filter*.conf;
7169

72-
include conf.d/error-pages.conf;
73-
include conf.d/gzip.conf;
74-
include conf.d/url-filter*.conf;
75-
76-
root /home/nginx/bnetdocs-www/src;
77-
index index.html index.xml index.htm;
70+
root /var/www/www.bnetdocs.org/src;
71+
index index.html index.xml index.htm;
7872

7973
location / {
74+
expires $bnetdocs_expires;
75+
try_files /static$uri /main.php$is_args$args;
76+
}
77+
78+
location /a/ {
8079
expires $bnetdocs_expires;
8180
try_files /static$uri /main.php$is_args$args;
81+
add_header 'Access-Control-Allow-Origin' '*';
82+
add_header 'Access-Control-Allow-Methods' 'GET,HEAD,OPTIONS';
83+
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
84+
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
8285
}
8386

84-
rewrite ^/archives(/.*)?$ https://redux.bnetdocs.org/archives$1 last;
87+
rewrite ^/archives(/.*)?$ $scheme://files.bnetdocs.org$1 last;
8588

8689
location = /favicon.ico {
87-
return 302 $scheme://$host/favicon.png$is_args$args;
90+
return 302 $scheme://$host/favicon.png$is_args$args;
8891
}
8992

90-
location = /main.php {
91-
fastcgi_hide_header X-Powered-By;
92-
add_header Strict-Transport-Security max-age=86400;
93-
fastcgi_buffer_size 128k;
94-
fastcgi_buffers 256 16k;
95-
fastcgi_busy_buffers_size 256k;
96-
fastcgi_intercept_errors off;
97-
fastcgi_param PHP_VALUE
98-
"display_errors = On
99-
error_reporting = E_ALL
100-
short_open_tag = Off";
101-
fastcgi_pass unix:/run/php-fpm/www.sock;
102-
fastcgi_temp_file_write_size 256k;
103-
include fastcgi.conf;
93+
location = /google7a3f778535b1424a.html {
94+
return 200 "google-site-verification: google7a3f778535b1424a.html";
10495
}
10596

97+
location = /main.php {
98+
add_header Strict-Transport-Security max-age=15552000; # 15552000 = 180 days
99+
100+
fastcgi_hide_header X-Powered-By;
101+
102+
fastcgi_buffer_size 128k;
103+
fastcgi_buffers 256 16k;
104+
fastcgi_busy_buffers_size 256k;
105+
fastcgi_temp_file_write_size 256k;
106+
107+
fastcgi_intercept_errors off;
108+
fastcgi_param PHP_VALUE "date.timezone = Etc/UTC
109+
display_errors = Off
110+
error_reporting = E_ALL
111+
short_open_tag = On";
112+
fastcgi_pass unix:/var/run/php-fpm/www.sock;
113+
include fastcgi.conf;
114+
}
106115
}

0 commit comments

Comments
 (0)