nginx+apache 如何设置才能解决 http 静态资源被拦截的问题?

2017-07-12 16:16:08 +08:00
 hguandl

我的 nginx 设置如下:

server {
	listen 80 default_server;
	listen 443 default;
	ssl on;
        ssl_certificate /root/certificate.crt;
        ssl_certificate_key /root/private.key;
	server_name _;
	return 403;
}

server {
	listen 443;
	listen 80;
	server_name example.com www.example.com;
	ssl on;
	ssl_certificate /root/certificate.crt;
	ssl_certificate_key /root/private.key;
	location ~ \.php$ {
		proxy_pass http://localhost:800;
                }
	error_page 497 https://$host$uri?$args;
}

我这样写的目的是阻止用 IP 直接访问以及强制使用 https 访问网页,想的是利用反向代理,使得连接到 nginx 用 https,然后服务器内部是直接转到 httpd 的 800 端口。但是有一个问题在于浏览器的安全策略会认为 httpd 里的 http 静态资源不安全,从而拒绝访问,如下图: 我想问一下能像我设想的那样连到 nginx 是 https,然后内部的转发用 http 吗?该如何设置,谢谢

3096 次点击
所在节点    NGINX
4 条回复
Showfom
2017-07-12 16:22:50 +08:00
这和你 nginx 没关系啊

你 WP 的 URL 设置
zuolan
2017-07-12 16:25:20 +08:00
看起来是 wp 没有设置域名吧?
msg7086
2017-07-12 16:32:50 +08:00
网页上的链接和你用的服务器没关系 = =
lslqtz
2017-07-13 11:36:07 +08:00
https 引入 http 的链接不报错才怪
这是常识了吧?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/374817

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX