nginx-ssl.sample.conf 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. # Uncomment if you are running lolisafe behind CloudFlare.
  10. #include /path/to/lolisafe/cloudflare-ips;
  11. }
  12. server {
  13. listen 443 ssl http2;
  14. listen [::]:443 ssl http2;
  15. server_name lolisafe.moe;
  16. ssl_certificate /path/to/your/fullchain.pem;
  17. ssl_certificate_key /path/to/your/privkey.pem;
  18. ssl_trusted_certificate /path/to/your/fullchain.pem;
  19. client_max_body_size 100M; # Change this to the max file size you want to allow
  20. # Uncomment if you are running lolisafe behind CloudFlare.
  21. #include /path/to/lolisafe/cloudflare-ips;
  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. }