新项目的域名是 https 的, 需要访问公司的图片服务器, 图片服务器的域名是 http 的, 因此做了一个 nginx 的转发
- server {
- listen 443;
server_name 新项目域名;
- #include ssl.conf;
- ssl on;
ssl_certificate keys/1_新项目证书_bundle.crt;
ssl_certificate_key keys/2_新项目证书. key;
- include qssl.conf;
- location / {
- include proxy.conf;
- proxy_pass http:// 新项目程序池名 (upstream.conf);
- }
location ~ /img / 图片服务器域名 (com|net)/ {
set $host_name 图片服务器域名;
- rewrite /img/(.).com/(.)$ /$2 break;
- rewrite /img/(.).net/(.*)$ /$2 break;
- proxy_set_header Host $host_name;
- proxy_pass http:// 图片服务器 ip;
-t 检查 nginx, 然后 - s reload
新项目即能访问图片
来源: http://www.bubuko.com/infodetail-2529744.html