add simple nginx config for php application

This commit is contained in:
Aleksandr Zaitsev 2024-07-19 15:15:54 +03:00
parent d1bf6fa959
commit eaf769177f

38
nginx-site.conf Normal file
View File

@ -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;
}
}