# TODO: replace , , and . # in vim use """:%s//replacement/g""" # CORS (1 of 2), allow my sites access to each other map $http_origin $allow_origin { ~^https://(.*\.)?digitaladapt.com$ $http_origin; default 'null'; } server { listen 443 ssl http2; listen [::]:443 ssl http2; ssl_certificate /etc/letsencrypt/live//fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live//privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot root /var/www/; index index.html index.php; server_name ; server_tokens off; # prevent nginx server detection # restrict access to git folder location ~ /\.git { return 404; } location / { # CORS (2 of 2), allow my sites access to each other # $allow_origin is created by map above, will only allow my domain access # block and replace the CORS header, to permit cross-site use proxy_hide_header 'access-control-allow-origin'; add_header 'access-control-allow-origin' "$allow_origin" always; add_header 'access-control-allow-credentials' 'true' always; try_files $uri $uri/ =404; } error_page 404 /404.html; access_log /var/log/nginx/.access.log tabbed_detailed; } server { listen 80; listen [::]:80; server_name ; server_tokens off; # prevent nginx server detection return 301 https://$server_name$request_uri; access_log /var/log/nginx/http.access.log tabbed_detailed; }