多层nginx实现https访问WordPress

我们先看一个场景,假如有服务器A和服务器B,两台服务器上都有nginx,然后WordPress部署在服务器B上。浏览器通过https访问服务器A,然后服务器A与服务器B的通讯是基于http协议的。然后这个时候我们就会发现,WordPress的静态资源都会走http协议,这个时候我们该如何处理呢,很简单,只需要修改服务器B的nginx配置即可。

 

配置如下:

 


server{
listen 10000;
index index.html index.htm index.php;
root /var/web/blog;

location / {

}
location ~ .php$ {
fastcgi_param HTTPS on;
fastcgi_param HTTP_HOST 'blog.yubang.app';

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

 

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注