# server
# {
# listen 80;
# server_name fishclaw.site www.fishclaw.site;
# rewrite ^(.*) https://www.fishclaw.site$1 permanent;
# }
server
{
server_name fishclaw.site www.fishclaw.site;
listen 80;
if ($scheme = 'http') {
# return 301 https://$server_name$request_uri;
return 301 https://www.fishclaw.site$request_uri;
}
listen 443 ssl http2;
if ($host = 'fishclaw.site') {
# rewrite ^(.*) https://www.fishclaw.site$1 permanent;
return 301 https://www.fishclaw.site$request_uri;
}
root /var/www/;
index index.html index.php;
ssl_certificate /var/www/ssl/_fishclaw.site_fullchain.crt;
ssl_certificate_key /var/www/ssl/_fishclaw.site_private.key;
# 开启目录列表显示
autoindex on;
autoindex_exact_size on;
autoindex_localtime on;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
charset utf-8;
location / {
# auto add index.php
try_files $uri $uri/ /index.php?$query_string;
}
error_page 404 /index.php;
location ~ (\.php)$ {
# include snippets/fastcgi-php.conf;
# fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
access_log /var/log/nginx/fishclaw.site/access.log;
error_log /var/log/nginx/fishclaw.site/error.log;
}