My public website https://www.chameth.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

nginx.conf 3.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. user nginx;
  2. worker_processes 1;
  3. error_log /var/log/nginx/error.log warn;
  4. pid /var/run/nginx.pid;
  5. events {
  6. worker_connections 1024;
  7. }
  8. http {
  9. include /etc/nginx/mime.types;
  10. default_type application/octet-stream;
  11. map $http_x_forwarded_for $forwarded_anon {
  12. ~(?P<ip>\d+\.\d+\.\d+)\. $ip.0;
  13. ~(?P<ip>[^:]+:[^:]+): $ip::;
  14. default 0.0.0.0;
  15. }
  16. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  17. '$status $body_bytes_sent "$http_referer" '
  18. '"$http_user_agent" "$forwarded_anon"';
  19. access_log /logs/access.log main;
  20. sendfile on;
  21. keepalive_timeout 65;
  22. server_tokens off;
  23. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
  24. add_header Content-Security-Policy "require-sri-for script; default-src 'none'; img-src 'self' https://photos.chameth.com https://a.c5h.io; style-src 'self'; font-src 'self'; frame-ancestors 'none'; frame-src https://contact.chameth.com; form-action 'none'; base-uri 'none';";
  25. add_header X-Frame-Options "SAMEORIGIN";
  26. add_header X-Content-Type-Options "nosniff";
  27. add_header X-XSS-Protection "1; mode=block";
  28. add_header Expect-CT "enforce; max-age=3600";
  29. add_header Referrer-Policy "no-referrer";
  30. gzip on;
  31. gzip_vary on;
  32. gzip_proxied any;
  33. gzip_comp_level 6;
  34. gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
  35. map $http_accept $webp_suffix {
  36. "~*webp" ".webp";
  37. }
  38. map $request_uri $redirect_uri {
  39. /res/images/sense/sense.jpg /2016/04/10/sense-api/sense.jpg;
  40. /res/images/wemo/switch.jpg /2016/05/02/monitoring-power-with-wemo/switch.jpg;
  41. /res/images/wemo/desk-1d.png /2016/05/02/monitoring-power-with-wemo/desk-1d.png;
  42. /res/images/wemo/desk-1w.png /2016/05/02/monitoring-power-with-wemo/desk-1w.png;
  43. /res/images/docker/logo.png /2016/05/21/docker-automatic-nginx-proxy/logo.png;
  44. /res/images/docker/reverse-proxy.png /2016/05/21/docker-automatic-nginx-proxy/reverse-proxy.png;
  45. /res/images/https/https-everywhere.jpg /2016/06/17/why-you-should-be-using-https/https-everywhere.jpg;
  46. }
  47. server {
  48. listen 80;
  49. server_name chameth.com localhost;
  50. if ( $redirect_uri ) {
  51. return 301 $redirect_uri;
  52. }
  53. location / {
  54. root /usr/share/nginx/html;
  55. index index.html index.htm;
  56. location /res {
  57. expires 1y;
  58. }
  59. location ~ \.(png|jpe?g)$ {
  60. try_files $uri$webp_suffix $uri =404;
  61. expires 1y;
  62. }
  63. }
  64. error_page 500 502 503 504 /50x.html;
  65. location = /50x.html {
  66. root /usr/share/nginx/html;
  67. }
  68. }
  69. server {
  70. server_name _;
  71. listen 80 default_server;
  72. return 301 https://chameth.com$request_uri;
  73. }
  74. }