nginx.conf 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. server {
  2. listen 80;
  3. server_name YOUR_DOMAIN;
  4. location / { return 301 https://$host$request_uri; }
  5. }
  6. server {
  7. listen 443 ssl;
  8. server_name YOUR_DOMAIN;
  9. ssl_protocols TLSv1.2;
  10. ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA;
  11. ssl_prefer_server_ciphers on;
  12. ssl_session_cache shared:SSL:10m;
  13. ssl_certificate /etc/CHANGE_THIS/fullchain.pem;
  14. ssl_certificate_key /etc/CHANGE_THIS/privkey.pem;
  15. keepalive_timeout 70;
  16. sendfile on;
  17. client_max_body_size 0;
  18. root /srv/http;
  19. index index.php;
  20. location ~* (?:DESIGN|(?:gpl|README|LICENSE)[^.]*|LEGALNOTICE)(?:\.txt)*$ {
  21. return 302 /;
  22. }
  23. location ~* \.(?:bat|git|ini|sh|svn[^.]*|txt|tpl|xml)$ {
  24. return 404;
  25. }
  26. rewrite ^/home/?$ / permanent;
  27. rewrite ^/login/?$ /login/login.php last;
  28. rewrite ^/auth/?$ /login/auth.php last;
  29. rewrite ^/logout/?$ /login/logout.php last;
  30. rewrite ^/terms/?$ /login/terms.php last;
  31. rewrite ^/local/?$ /local.php last;
  32. rewrite ^/federated/?$ /federated.php last;
  33. rewrite ^/notifications/?$ /notifications.php last;
  34. rewrite ^/search/?$ /search_hash_tag.php last;
  35. rewrite ^/search/users/?$ /search_user.php last;
  36. rewrite ^/settings/?$ /settings_general.php last;
  37. rewrite ^/settings/profile/?$ /settings_profile.php last;
  38. rewrite ^/settings/appearance/?$ /settings_appearance.php last;
  39. rewrite ^/@(.+)@(.+).([a-z]+)/?$ /user.php?user=@$1@$2.$3 last;
  40. rewrite ^/@(.+)@(.+).([a-z]+)/status/(.+?)?$ /user.php?user=@$1@$2.$3&status=$4 last;
  41. rewrite ^/@(.+)@(.+).([a-z]+)/media/?$ /user_only_media.php?user=@$1@$2.$3 last;
  42. rewrite ^/@(.+)@(.+).([a-z]+)/with_replies/?$ /user_include_replies.php?user=@$1@$2.$3 last;
  43. rewrite ^/@(.+)@(.+).([a-z]+)/followers/?$ /user_followers.php?user=@$1@$2.$3 last;
  44. rewrite ^/@(.+)@(.+).([a-z]+)/following/?$ /user_following.php?user=@$1@$2.$3 last;
  45. rewrite ^/@(.+)@(.+).([a-z]+)/favourites/?$ /user_favorite.php?user=@$1@$2.$3 last;
  46. rewrite ^/avatars/original/missing.png$ /assets/images/missing.png last;
  47. rewrite ^/headers/original/missing.png$ /assets/images/missing_header.png last;
  48. rewrite ^/404/?$ /404.php last;
  49. location ~ [^/]\.php(/|$) {
  50. fastcgi_split_path_info ^(.+?\.php)(/.*)$;
  51. if (!-f $document_root$fastcgi_script_name) {
  52. return 404;
  53. }
  54. fastcgi_buffers 8 256k;
  55. fastcgi_buffer_size 128k;
  56. fastcgi_intercept_errors on;
  57. include fastcgi_params;
  58. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  59. fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
  60. }
  61. }