nginx-ssl.sample.conf 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. upstream backend {
  2. server 127.0.0.1:9999; # Change to the port you specified on lolisafe
  3. }
  4. map $sent_http_content_type $charset {
  5. ~^text/ utf-8;
  6. }
  7. server {
  8. listen 80;
  9. listen [::]:80;
  10. server_name lolisafe.moe;
  11. return 301 https://$server_name$request_uri;
  12. }
  13. server {
  14. listen 443 ssl http2;
  15. listen [::]:443 ssl http2;
  16. server_name lolisafe.moe;
  17. server_tokens off;
  18. ssl_certificate /path/to/your/fullchain.pem;
  19. ssl_certificate_key /path/to/your/privkey.pem;
  20. ssl_trusted_certificate /path/to/your/fullchain.pem;
  21. client_max_body_size 100M; # Change this to the max file size you want to allow
  22. charset $charset;
  23. charset_types *;
  24. # Uncomment if you are running lolisafe behind CloudFlare.
  25. # This requires NGINX compiled from source with:
  26. # --with-http_realip_module
  27. #include /path/to/lolisafe/real-ip-from-cf;
  28. location / {
  29. add_header Access-Control-Allow-Origin *;
  30. root /path/to/your/uploads/folder;
  31. try_files $uri @proxy;
  32. }
  33. location @proxy {
  34. proxy_set_header X-Real-IP $remote_addr;
  35. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  36. proxy_set_header Host $http_host;
  37. proxy_set_header X-NginX-Proxy true;
  38. proxy_pass http://backend;
  39. proxy_redirect off;
  40. proxy_http_version 1.1;
  41. proxy_set_header Upgrade $http_upgrade;
  42. proxy_set_header Connection "upgrade";
  43. proxy_redirect off;
  44. proxy_set_header X-Forwarded-Proto $scheme;
  45. }
  46. }