vps.conf 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. server {
  2. listen 80;
  3. listen [::]:80;
  4. server_name 127.0.0.1 localhost;
  5. root /home/vps/public_html;
  6. access_log /var/log/nginx/vps-access.log;
  7. error_log /var/log/nginx/vps-error.log error;
  8. listen 443 ssl; # managed by Certbot
  9. # RSA certificate
  10. ssl_certificate /etc/letsencrypt/live/vpn.aidan.my/fullchain.pem; # managed by Certbot
  11. ssl_certificate_key /etc/letsencrypt/live/vpn.aidan.my/privkey.pem; # managed by Certbot
  12. include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
  13. # Redirect non-https traffic to https
  14. if ($scheme != "https") {
  15. return 301 https://$host$request_uri;
  16. } # managed by Certbot
  17. location / {
  18. index index.php index.html index.htm;
  19. try_files $uri $uri/ /index.php?$args;
  20. }
  21. location ~ \.php$ {
  22. include /etc/nginx/fastcgi_params;
  23. fastcgi_pass 127.0.0.1:9000;
  24. fastcgi_index index.php;
  25. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  26. }
  27. }
  28. server {
  29. if ($host = localhost) {
  30. return 301 https://$host$request_uri;
  31. } # managed by Certbot