nginx.conf 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. # Main
  27. rewrite ^/home/?$ / permanent;
  28. rewrite ^/login/?$ /login/login.php break;
  29. rewrite ^/auth/?$ /login/auth.php break;
  30. rewrite ^/logout/?$ /login/logout.php break;
  31. rewrite ^/terms/?$ /login/terms.php break;
  32. # LTL
  33. rewrite ^/local/?$ /local.php break;
  34. # FTL
  35. rewrite ^/federated/?$ /federated.php break;
  36. # Notice
  37. rewrite ^/notifications/?$ /notifications.php break;
  38. # Who to follow
  39. rewrite ^/whotofollow/?$ /who_to_follow.php break;
  40. # Search
  41. rewrite ^/search/?$ /search_hash_tag.php break;
  42. rewrite ^/search/users/?$ /search_user.php break;
  43. # Settings
  44. rewrite ^/settings/?$ /settings_general.php break;
  45. rewrite ^/settings/profile/?$ /settings_profile.php break;
  46. rewrite ^/settings/appearance/?$ /settings_appearance.php break;
  47. # User
  48. rewrite ^/@(.+)@(.+)\.([a-z]+)/?$ /user.php?user=@$1@$2\.$3 break;
  49. rewrite ^/@(.+)@(.+)\.([a-z]+)/status/(.+?)?$ /user.php?user=@$1@$2\.$3&status=$4 break;
  50. rewrite ^/@(.+)@(.+)\.([a-z]+)/media/?$ /user_only_media.php?user=@$1@$2\.$3 break;
  51. rewrite ^/@(.+)@(.+)\.([a-z]+)/with_replies/?$ /user_include_replies.php?user=@$1@$2\.$3 break;
  52. rewrite ^/@(.+)@(.+)\.([a-z]+)/followers/?$ /user_followers.php?user=@$1@$2\.$3 break;
  53. rewrite ^/@(.+)@(.+)\.([a-z]+)/following/?$ /user_following.php?user=@$1@$2\.$3 break;
  54. rewrite ^/@(.+)@(.+)\.([a-z]+)/favourites/?$ /user_favorite.php?user=@$1@$2\.$3 break;
  55. # Image
  56. rewrite ^/avatars/original/missing.png$ /assets/images/missing.png break;
  57. rewrite ^/headers/original/missing.png$ /assets/images/missing_header.png break;
  58. # 404
  59. rewrite ^/404/?$ /404.php break;
  60. location ~ [^/]\.php(/|$) {
  61. fastcgi_split_path_info ^(.+?\.php)(/.*)$;
  62. if (!-f $document_root$fastcgi_script_name) {
  63. return 404;
  64. }
  65. fastcgi_buffers 8 256k;
  66. fastcgi_buffer_size 128k;
  67. fastcgi_intercept_errors on;
  68. include fastcgi_params;
  69. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  70. fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
  71. }
  72. }