nginx 的重定向问题(小白提问)
小白找不到问题,求解答,非常感谢:
server {
listen 443 ssl;
listen 80;
server_name ABC.com www.ABC.com;
client_max_body_size 500m;
root /var/www/wordpress/;
index index.php index.html index.htm index.nginx-debian.html;
#if ($scheme = http ) {return 301 https://$host$request_uri;}
ssl_certificate /etc/letsencrypt/live/ABC.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ABC.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/ABC.com/chain.pem;
include snippets/ssl.conf;
return 301 https://ABC.com$request_uri;
include snippets/letsencrypt.conf;
location / {
# try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
location ~ /.ht {
deny all;
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* .(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
}