typecho nginx https

新建了一个服务器,安装了Typecho 1.2.0 Nginx 1.20.2 PHP 7.4.29 MariaDB 10.5.15后,可以访问了,配置好域名之后,想配置https,但是遇到了点问题:直接访问https打开的是nginx的默认页面。不能访问typecho主页。折腾了一段时间,最终还是把nginx配置好了。可以使用的nginx配置如下:

server {
    listen 80;
    server_name lcslearn.top;
    #将请求转成https
    rewrite ^(.*)$ https://$host$1 permanent;
}
server {
    listen 443 ssl;
    server_tokens off;
    keepalive_timeout 5;
    root /usr/local/lighthouse/softwares/typecho; 
    index index.php index.html;
    access_log logs/typecho.log;
    error_log logs/typecho.error.log;
    server_name lcslearn.top;
    ssl_certificate lcslearn.top_bundle.crt;
    ssl_certificate_key lcslearn.top.key;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;
    location ~* \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            include fastcgi.conf;
            client_max_body_size 20m;
            fastcgi_connect_timeout 30s;
            fastcgi_send_timeout 30s;
            fastcgi_read_timeout 30s;
            fastcgi_intercept_errors on;
            try_files $uri $uri/ /index.php?$query_string;
            if (!-e $request_filename){
                    rewrite ^/(.*) /index.php last;
            }
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}