nginx 配置https,tp5.1
server { listen 443 ssl;# http2 default_server; server_name 域名; root 访问目录; index index.html; ssl_certificate "pem"; #ssl中pem的目录文件 ssl_certificate_key "key"; #ssl中key的目录文件 ssl_session_timeout 10m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_prefer_server_ciphers on; charset utf-8; #正常配置文件 location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=/$1 last; break; } index index.html index.htm index.php; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } location ~ \.php(.*)$ { root 文件访问路径; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; }}
server { listen 80; server_name 域名; #如果访问多个域名用逗号隔开 rewrite ^(.*)$ https://$host$1 permanent; #http转换成https } 如果有多个配置文件,直接复制粘贴