nginx.conf 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. server {
  2. listen 443 ssl http2;
  3. listen [::]:443 ssl http2;
  4. server_name pixelfed.example; # change this to your fqdn
  5. root /home/pixelfed/public; # path to repo/public
  6. ssl_certificate /etc/nginx/ssl/server.crt; # generate your own
  7. ssl_certificate_key /etc/nginx/ssl/server.key; # or use letsencrypt
  8. ssl_protocols TLSv1.2;
  9. ssl_ciphers EECDH+AESGCM:EECDH+CHACHA20:EECDH+AES;
  10. ssl_prefer_server_ciphers on;
  11. add_header X-Frame-Options "SAMEORIGIN";
  12. add_header X-XSS-Protection "1; mode=block";
  13. add_header X-Content-Type-Options "nosniff";
  14. index index.html index.htm index.php;
  15. charset utf-8;
  16. client_max_body_size 15M;
  17. location / {
  18. try_files $uri $uri/ /index.php?$query_string;
  19. }
  20. location = /favicon.ico { access_log off; log_not_found off; }
  21. location = /robots.txt { access_log off; log_not_found off; }
  22. error_page 404 /index.php;
  23. location ~ \.php$ {
  24. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  25. try_files $fastcgi_script_name =404;
  26. fastcgi_pass unix:/run/php-fpm/php-fpm.sock; # make sure this is correct
  27. fastcgi_index index.php;
  28. include fastcgi_params;
  29. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # or $request_filename
  30. }
  31. location ~ /\.(?!well-known).* {
  32. deny all;
  33. }
  34. }
  35. server { # Redirect http to https
  36. server_name pixelfed.example; # change this to your fqdn
  37. listen 80;
  38. listen [::]:80;
  39. return 301 https://$host$request_uri;
  40. }