GHOST搭建疑难问题记录(三)
ghost博客nginx配置
1.NGINX配置
#配置一个代理即tomcat1服务器
upstream tomcat_server1 {
server localhost:2368;
}
#配置永久跳转
server {
listen 80;
server_name **.cn,www.**.cn;
rewrite ^/(.*)$ https://**.cn/$1 permanent;
location / {
#域名codergroup.cn的请求全部转发到tomcat_server1即tomcat1服务上
proxy_pass http://tomcat_server1;
proxy_set_header Host $host:80;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#欢迎页面,按照从左到右的顺序查找页面
index index.jsp index.html index.htm;
}
client_max_body_size 30M;
}
2.https证书使用
当使用https时,在80代理2368时,强制跳转到https,但由于GHOST自身问题,内部一些接口是http,网站用的是 https 要跳转到 http 请求时就会报错。
解决办法:
在default.hbs里加入<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
3.ghost服务
