nginx + php + https 配置


server {
        listen 80;
        server_name   你的域名或IP;
        rewrite ^(.*)$  https://$host$1 permanent;
}

server {
        listen 443 ssl;
        server_name 你的域名或IP;
        root 站點文件路徑;
        index index.php index.html;

        ssl_certificate   證書.pem文件路徑;
        ssl_certificate_key  證書.key文件路徑;

        location ~ \.php$ {
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include        fastcgi_params;
        }
}

更改保存后需要重新加載下 nginx 配置文件

nginx -s reload


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM