server
{
listen 80;
server_name 域名;
return 301 https://$host$request_uri; #这个是跳转域名到 https
}
server
{
listen 443;#这个是https 需要的 443端口 必须使用443端口
server_name 域名;
index index.html index.htm index.php;
root /www/web;
#root /home/wwwroot/web;
#这个是 https 需要的配置
ssl on;
ssl_certificate /root/ssl/https.pem; #这个是指定对应目录的 .pem文件
ssl_certificate_key /root/ssl/https.key;#这个是指定对应目录的 .key文件
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
ssl_prefer_server_ciphers on;
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~ \.php($|/){
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
include enable-php.conf;
location /nginx_status
{
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log /home/wwwlogs/web.log;
}本文为Jsky原创文章,转载无需和我联系,但请注明来自Jsky博客 www.tjin.link
