流星,NGINX子路径错误
METEOR, NGINX subpath error
我有一个应用程序部署了nginx和docker,现在我添加了第二个应用程序也与docker,所以,这将是情况
DOCKER_METEOR_APP1
DOCKER_METEOR_APP2
在同一个服务器SERVER_IP
http://SERVER_IP/DOCKER_METEOR_APP1 http://SERVER_IP/DOCKER_METEOR_APP2我的NGINX配置是:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# HTTP
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
server_name MY_COOL_SERVER;
location /DOCKER_METEOR_APP1 {
proxy_pass http://SERVER_IP:8001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-For $remote_addr;
if ($uri != '/') {
expires 30d;
}
}
location /DOCKER_METEOR_APP2 {
proxy_pass http://SERVER_IP:8002;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-For $remote_addr;
if ($uri != '/') {
expires 30d;
}
}
}
每次我尝试访问一个或其他应用程序,我得到页面标题和错误…它似乎试图从根路径加载内容,比如
http://SERVER_IP.com/hjas867651877e1u9812931.css?..。
我做错了什么?有解决办法吗?
好了…我对这个问题的解决方案
- 为 上的每个应用添加了ROOT_URL
ENV ROOT_URL http://127.0.0.1/DOCKER_METEOR_APP1
- 同样,在
lib/startup.js
Meteor.startup(function() {
process.env.ROOT_URL = 'http://127.0.0.1/DOCKER_METEOR_APP1/';
});
- …在我的react路由器上得到这个:
const history = useBasename( createHistory )(
{ basename: '/DOCKER_METEOR_APP1' }
)
<Router history={history}>
相关文章:
- javascript window.location在检查firebug时给了我一个错误的url路径
- 最短路径算法js错误
- AngularFire 0.5美元移除.错误:Firebase.child失败:第一个参数是无效路径
- windows文件系统中的nodejs路径错误4058 ENOENT
- 路径错误中的非法字符
- 使用Raphael.js绘制双动画路径错误
- Javascript /npm安装路径错误
- 流星,NGINX子路径错误
- Grunt Dist文件夹相对路径错误
- 为什么在Durandal Get started教程中,text.js的请求路径错误?
- SVG路径错误"d"属性
- 弹出asp.net页面,javascript和路径错误404
- 在Ember项目中包含外部JS文件的路径错误(不确定)
- Extract-text-webpack-plugin输出CSS文件,图像路径错误
- Nodejs中的相对路径错误
- Webpack,新块加载路径错误
- 使用Ajax访问其他目录中的文件时出现问题,是我指定的路径错误吗
- IE8上的jQuery选择器路径错误
- 木偶.js需要.js模板路径错误
- Firebase child_added事件返回无效路径错误