nginx.conf.sample 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. server {
  2. listen [::]:80;
  3. listen 80;
  4. # FIXME: change domain name here (and also make sure you do the same in the next 'server' section)
  5. server_name social.example.org;
  6. # redirect all traffic to HTTPS
  7. rewrite ^ https://$host$request_uri? permanent;
  8. }
  9. server {
  10. # HTTPS is mandatory on GNU social unless you are using Tor network. Seriously. Set it up with a cert (any cert) before you run the install.
  11. listen [::]:443 ssl http2;
  12. listen 443 ssl http2;
  13. # Root
  14. # Change the path below to where you installed
  15. # GNU social
  16. root /path/to/gnusocial/root;
  17. # Server name
  18. # Change "social.example.org" to your site's domain name
  19. # GNU social MUST be installed in the domain root
  20. server_name social.example.org;
  21. # SSL
  22. # Uncomment and change the paths to setup
  23. # your SSL key/cert. See https://cipherli.st/
  24. # for more information
  25. ssl_certificate ssl/certs/social.example.org.crt;
  26. ssl_certificate_key ssl/private/social.example.org.key;
  27. # Logs
  28. # Uncomment and change the paths to setup
  29. # logging
  30. #access_log /path/to/access.log;
  31. #error_log /path/to/error.log;
  32. # Index
  33. index index.php;
  34. # PHP
  35. location /index.php {
  36. include fastcgi_params;
  37. include snippets/fastcgi-php.conf;
  38. fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
  39. fastcgi_param SCRIPT_FILENAME $request_filename;
  40. # Further optional configuration
  41. #fastcgi_buffer_size 128K;
  42. #fastcgi_buffers 4 256K;
  43. #fastcgi_busy_buffers_size 256K;
  44. #fastcgi_read_timeout 600s;
  45. #fastcgi_send_timeout 300s;
  46. #fastcgi_connect_timeout 75s;
  47. #http2_push_preload on;
  48. }
  49. # Location
  50. location / {
  51. try_files $uri $uri/ @index_handler;
  52. }
  53. # Fancy URLs
  54. error_page 404 @index_handler;
  55. location @index_handler {
  56. rewrite ^(.*)$ /index.php?p=$1 last;
  57. }
  58. # Restrict access that is unnecessary anyway
  59. location ~ /\.(ht|git) {
  60. deny all;
  61. }
  62. #
  63. # Hardening (optional)
  64. #
  65. # add_header Strict-Transport-Security "max-age=15768000; preload;";
  66. # add_header X-Content-Type-Options nosniff;
  67. # add_header Referrer-Policy strict-origin-when-cross-origin;
  68. # add_header Content-Security-Policy "default-src 'self' 'unsafe-inline'; frame-ancestors 'self'; form-action 'self'; style-src 'self' 'unsafe-inline'; img-src * blob: data:;";
  69. # add_header X-Permitted-Cross-Domain-Policies none;
  70. # add_header X-Robots-Tag all; # Not really hardening, just here for strictness purposes
  71. #
  72. # client_max_body_size 15M;
  73. # client_body_buffer_size 128k;
  74. # gzip_vary on;
  75. #
  76. # location ~* \.(?:css|js|woff|svg|gif|png|webp|ttf|ico|jpe?g)$ {
  77. # gzip on;
  78. # gzip_comp_level 4;
  79. # add_header Cache-Control "public";
  80. # expires 30d;
  81. # access_log off;
  82. # log_not_found off;
  83. # }
  84. }