35 行
835 B
Nginx Configuration File
35 行
835 B
Nginx Configuration File
server {
|
|
server_name ドメイン名;
|
|
root /var/www/htdocs/www;
|
|
index index.php;
|
|
|
|
location / {
|
|
satisfy any;
|
|
allow all;
|
|
try_files $uri $uri/ /index.php?$query_string;
|
|
}
|
|
|
|
location ~ \.php$ {
|
|
try_files $uri =404;
|
|
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
|
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
|
fastcgi_index index.php;
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
include fastcgi_params;
|
|
}
|
|
|
|
listen 443 ssl http2;
|
|
ssl_certificate /etc/letsencrypt/live/ドメイン名/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/ドメイン名/privkey.pem;
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
}
|
|
|
|
server {
|
|
if ($host = ドメイン名) { return 301 https://$host$request_uri; }
|
|
|
|
listen 80;
|
|
server_name ドメイン名;
|
|
|
|
return 404;
|
|
}
|