diff --git a/nginx-site.conf b/nginx-site.conf new file mode 100644 index 0000000..cafd432 --- /dev/null +++ b/nginx-site.conf @@ -0,0 +1,38 @@ +server { + listen 80; + server_name testdomain.com www.testdomain.com; + + return 301 https://$host$request_uri; +} + +server { + listen 443 ssl; + server_name testdomain.com www.testdomain.com; + + # SSL configuration + ssl_certificate /etc/letsencrypt/live/testdomain.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/testdomain.com/privkey.pem; + + # Improve HTTPS security (optional, but recommended) + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + root /home/www/testdomain.com; + index index.php index.html index.htm; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location ~ \.php$ { + include snippets/fastcgi-php.conf; + fastcgi_pass unix:/var/run/php/php-fpm.sock; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + + location ~ /\.ht { + deny all; + } +} \ No newline at end of file