shell-things/etc/nginx/sites-enabled/old/host.nginx

88 lines
3.8 KiB
Plaintext
Raw Normal View History

2014-12-27 10:09:00 +01:00
server {
2023-05-18 10:33:33 +02:00
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
listen 443 default_server ssl http2;
listen [::]:443 default_server ssl http2 ipv6only=on;
root /var/www/default/;
index index.php index.html index.htm;
### Generating SSL certificate:
## mkdir -p /etc/nginx/ssl && cd /etc/nginx/ssl
## openssl req -x509 -nodes -days 3650 -newkey rsa:4096 -keyout nginx.key -out nginx.crt
### this takes forever and is used on line 23.
## openssl dhparam -out dhparam.pem 4096
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
# ----- begin of Mozilla Server Side TLS recommendations -----
# **2014-11-07** https://wiki.mozilla.org/Security/Server_Side_TLS
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:50m;
2023-02-21 18:08:54 +01:00
# Diffie-Hellman parameter for DHE ciphersuites, recommended 4096 bits
# See generation on line 14
2023-05-18 10:33:33 +02:00
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
2023-02-21 18:08:54 +01:00
# Intermediate configuration. tweak to your needs.
# comment just for me, don't uncomment.
#ssl_ciphers '';
2023-05-18 10:33:33 +02:00
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
2023-02-21 18:08:54 +01:00
ssl_prefer_server_ciphers on;
# Enable this if your want HSTS (recommended)
2023-05-18 10:33:33 +02:00
add_header Strict-Transport-Security
"max-age=15552000; includeSubdomains; preload";
2023-05-18 10:33:33 +02:00
add_header X-Frame-Options SAMEORIGIN;
add_header Content-Security-Policy
upgrade-insecure-requests;
2023-05-18 10:33:33 +02:00
add_header X-Xss-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
2023-02-21 18:08:54 +01:00
# OCSP Stapling ---
# fetch OCSP records from URL in ssl_certificate and cache them
2023-05-18 10:33:33 +02:00
ssl_stapling on;
ssl_stapling_verify on;
2023-02-21 18:08:54 +01:00
## verify chain of trust of OCSP response using Root CA and Intermediate certs
#ssl_trusted_certificate /path/to/root_CA_cert_plus_intermediates;
#resolver ::1;
2023-05-18 10:33:33 +02:00
# ----- end of Mozilla Server Side TLS recommendations -----
2023-02-21 18:08:54 +01:00
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
autoindex on;
}
2014-12-27 10:09:00 +01:00
2023-02-21 18:08:54 +01:00
# Userdir
location ~ ^/~(.+?)(/.*)?$ {
2023-05-18 10:33:33 +02:00
alias /home/$1/public_html$2;
index index.html index.htm;
2023-02-21 18:08:54 +01:00
autoindex on;
}
2014-12-27 10:09:00 +01:00
2023-02-21 18:08:54 +01:00
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /usr/share/nginx/html;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
2023-05-18 10:33:33 +02:00
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
2023-02-21 18:08:54 +01:00
#include fastcgi_params;
2023-05-18 10:33:33 +02:00
include fastcgi.conf;
2023-02-21 18:08:54 +01:00
}
2014-12-27 10:09:00 +01:00
2023-02-21 18:08:54 +01:00
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}