wordpress重定向及nginx配置wordpress重定向
location / {
index index.html index.php;
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
nginx 配置文件}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
https配置
1. 在阿⾥云或其他地⽅申请证书⽂件得到如:
214040226730432.key  214040226730432.pem
放到如  /etc/nginx/cert⽬录下
server {
listen 443;
server_name jadewen.win www.jadewen.win;
ssl on;
root /var/www/default;
index index.php index.html;
ssl_certificate  cert/214040226730432.pem;
ssl_certificate_key  cert/214040226730432.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
f;
}
}
3.重定向http到https
server {
listen        80;
server_name  jadewen.win www.jadewen.win;
}
nginx配置⼆级域名
配置多个server块映射到不同⽬录即可,但是免费的https证书只能⽀持⼀个主域名,⼆级域名仍然只能是http的server {
listen        80;
server_name  blog.jadewen.win;
root          /var/www/blog;
index        index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;    fastcgi_index index.php;
f;
}
}

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。