如何在NginX反向代理配置中更正Meteor基本URL

如何在NginX反向代理配置中更正Meteor基本URL

本文介绍了如何在NginX反向代理配置中更正Meteor基本URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过反向代理(在Ubuntu服务器上)在NginX后面安装了Apache和Meteor.将Apache直接映射为baseURL(www.mydomain.com/),将Meteor映射为子文件夹(www.mydomain.com/live/).

I have installed both Apache and Meteor behind NginX through reverse-proxy (on an Ubuntu server). Apache is mapped directly as baseURL (www.mydomain.com/) and Meteor is mapped as a subfolder (www.mydomain.com/live/).

我遇到的问题是我的Meteor测试(在端口3000上可以正常工作)在NginX后面停止工作,因为每个单独的引用(CSS,Javascript,模板)对于baseURL都是绝对的.

The problem I encounter is that my Meteor test (which works as expected at port 3000) stops working behind NginX since every single references (CSS, Javascript, template) are absolute to baseURL.

<html>
<head>
  <link rel="stylesheet" href="/live.css?abc">
  <script type="text/javascript" src="/packages/underscore/underscore.js?efg"></script>
  ...
  <script type="text/javascript" src="/template.live.js?hij"></script>
  <script type="text/javascript" src="/live.js?klm"></script>
</head>

很明显,由于Apache映射在baseURL上,因此在通过NginX进行测试时找不到这些文件.

Obviously, since Apache is mapped at baseURL, these files are not found when testing through NginX.

解决问题的最佳方法是什么?系统管理不是我的专长,Meteor是我对服务器端javascript的首次入侵.因此,我什至不知道是否可以解决此问题,如果可以,是通过服务器配置,流星配置还是通过编程完成.

What would be the best way to resolve to problem? System Administration is not my forte, and Meteor is my first incursion at server-side javascript. So I don't even know if this can be fixed, and if so, if it's done through a server configuration, Meteor configuration or programmatically.

流星0.4.0中新的绝对URL"包解决了该问题!

The new "absolute-url" package in Meteor 0.4.0 fixed the problem!

http://docs.meteor.com/#absoluteurl

推荐答案

流星0.4.0中新的绝对URL"包解决了该问题.

The new "absolute-url" package in Meteor 0.4.0 fixed the problem.

http://docs.meteor.com/#absoluteurl

这篇关于如何在NginX反向代理配置中更正Meteor基本URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 00:07