#主站
server {
#这里是ssl 对应配置,从对应的云服务器copy demo对应填写即可
listen 443 ssl;
ssl on;
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;
add_header Access-Control-Allow-Origin *;
#注意关键词proxy_pass
location ~* \.html$ {
rewrite ^/([\d]+)\.html$ /article/detail/$1 break;
}
location / {
root /home/yiiblog/frontend/web;
index index.html index.php;
if (!-e $request_filename){
rewrite ^/(.*) /index.php last;
}
}
#没有下面 cgi(Common Gateway Interface)将无法解析php
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
root /home/yiiblog/frontend/web;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#对应资源,不区分大小写,301强跳,便于cdn
location ~* \.(png|jpg|jpeg||gif|js|css|woff2|eot|ttf|woff|svg|otf)$ {
}
}
server {
listen 80 default_server;
#重定向到www
}
server {
listen 443 ;
ssl on;
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 / {
rewrite ^/(.*)$ /article/listshow?menu_id=101 break;
}
}
server {
listen 80;#这个不能省略啊
rewrite ^(.*)$ https://${server_name}$1 permanent;
}