]> git.somenet.org - root/pub/somesible.git/blob - roles/server/nginx/server/files/default/000-default.vhost
[roles/server/nginx/server] install nginx server
[root/pub/somesible.git] / roles / server / nginx / server / files / default / 000-default.vhost
1 #
2 ################################################
3 ### Managed by someone's ansible provisioner ###
4 ################################################
5 # Part of: https://git.somenet.org/root/pub/somesible.git
6 # 2017-2024 by someone <someone@somenet.org>
7 #
8
9
10 server {
11     listen 443 ssl default_server http2;
12     listen [::]:443 ssl default_server http2;
13     server_name _;
14
15     ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
16     ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
17     ssl_protocols TLSv1.2 TLSv1.3;
18     ssl_ciphers HIGH:!aNULL:!MD5:!SHA1:!SHA256:!SHA384;
19     ssl_prefer_server_ciphers on;
20 #    ssl_dhparam /etc/nginx/dhparams.pem;
21     ssl_session_cache shared:SSL:10m;
22
23     ### <letsencrypt>
24     location ^~ /.well-known/acme-challenge {
25         alias /var/www/html/dehydrated;
26     }
27     ### </letsencrypt>
28     ### <stats>
29     location /nginx_status {
30         stub_status;
31         allow 127.0.0.1;
32         allow ::1;
33         deny all;
34     }
35     ### </stats>
36     ### <dotfile protection>
37     location ~ /\.(?!well-known\/).* {
38         return 404;
39     }
40     ### </dotfile protection>
41     ### <robots.txt>
42     location = /robots.txt {
43         root /var/www/;
44         try_files /html/$uri =404;
45     }
46     ### </robots.txt>
47     ### <awstats>
48     location ^~ /awstats-icon {
49         alias /usr/share/awstats/icon/;
50         auth_pam "awstats";
51         auth_pam_service_name "nginx-awstats";
52         access_log off;
53     }
54     location = /awstats.pl {
55         root /usr/lib/cgi-bin/;
56         auth_pam "awstats";
57         auth_pam_service_name "nginx-awstats";
58         access_log off;
59
60         gzip off;
61         include fastcgi_params;
62         fastcgi_pass unix:/var/run/fcgiwrap.socket;
63         fastcgi_param SCRIPT_FILENAME /usr/lib/cgi-bin/awstats.pl;
64     }
65     ### </awstats>
66 }
67
68
69 server {
70     listen 80 default_server;
71     listen [::]:80 default_server;
72     server_name _;
73
74     ### <letsencrypt>
75     location ^~ /.well-known/acme-challenge {
76         alias /var/www/html/dehydrated;
77     }
78     ### </letsencrypt>
79     ### <stats>
80     location /nginx_status {
81         stub_status;
82         allow 127.0.0.1;
83         allow ::1;
84         deny all;
85     }
86     ### </stats>
87
88     # redirect everything to https except for /.well-known/acme-challenge and /nginx_status
89     location / {
90         return 301 https://$host$request_uri;
91     }
92 }