nginx-ssl.sample.conf 1.2 KB

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