website_nginx.conf 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Upstream component nginx needs to connect to.
  2. upstream django {
  3. server unix:///opt/h0v1n8-website-env/website/website.sock; # For production file socket
  4. #server 127.0.0.1:8001; # Web port socket for use with uwsgi-hello-world-test.py
  5. }
  6. # HTTPS redirect
  7. server {
  8. listen 80 default_server;
  9. listen [::]:80 default_server;
  10. server_name _;
  11. #return 301 https://h0v1n8.nl$request_uri;
  12. return 301 https://$request;
  13. }
  14. # RotBot redirect. rotbot.h0v1n8.nl is the pointer record for the vps, so the bot looks cooler on IRC.
  15. server {
  16. listen 443 ssl;
  17. listen [::]:443 ssl;
  18. server_name rotbot.h0v1n8.nl;
  19. ssl_certificate /etc/letsencrypt/live/h0v1n8.nl/fullchain.pem;
  20. ssl_certificate_key /etc/letsencrypt/live/h0v1n8.nl/privkey.pem;
  21. return 301 https://h0v1n8.nl/rotbot$request_uri;
  22. }
  23. # Configuration of the server
  24. server {
  25. # the port your site will be served on
  26. listen 443 ssl;
  27. listen [::]:443 ssl;
  28. # the domain name it will serve for
  29. server_name h0v1n8.nl www.h0v1n8.nl; # substitute your machine's IP address or FQDN
  30. ssl_certificate /etc/letsencrypt/live/h0v1n8.nl/fullchain.pem;
  31. ssl_certificate_key /etc/letsencrypt/live/h0v1n8.nl/privkey.pem;
  32. charset utf-8;
  33. # max upload size
  34. client_max_body_size 75M; # adjust to taste
  35. # Django media
  36. #location /media {
  37. # alias /path/to/your/mysite/media; # your Django project's media files - amend as required
  38. #}
  39. location /static {
  40. alias /srv/www/static; # your Django project's static files - amend as required
  41. }
  42. # Finally, send all non-media requests to the Django server.
  43. location / {
  44. uwsgi_pass django;
  45. include /opt/h0v1n8-website-env/uwsgi_params; # the uwsgi_params file you installed
  46. }
  47. }