Meteor 应用程序未出现在使用 Mup 部署和 NGINX 的 AWS 上
Meteor application not appearing on AWS using Mup deployment & NGINX
我正在尝试使用 Meteor Up (mup) 将 Meteor 应用程序部署到 Amazon Web Services 实例。我遵循了本指南 https://sergelobatch.com/beginners-guide-to-deploying-a-meteor-app-to-an-aws-server-with-meteor-up/,到目前为止,它已经成功地帮助我解决了这个障碍。
Mup 设置和 Mup 部署都 运行 成功。通过浏览器访问 ip 后,我收到拒绝连接错误。
流星版本 1.5.4
更新 1.4.5
这是我的 mup.js
module.exports = {
servers: {
one: {
// TODO: set host address, username, and authentication method
host: '54.206.11.xx',
username: 'ubuntu',
pem: '~/.ssh/MyClient-Staging.pem'
// password: 'server-password'
// or neither for authenticate from ssh-agent
}
},
app: {
// TODO: change app name and path
name: 'MyClient',
path: '../',
servers: {
one: {},
},
buildOptions: {
serverOnly: true,
},
env: {
// TODO: Change to your app's url
// If you are using ssl, it needs to start with https://
ROOT_URL: 'http://54.206.11.xx',
MONGO_URL: 'mongodb://mongodb/meteor',
MONGO_OPLOG_URL: 'mongodb://mongodb/local',
},
docker: {
// change to 'abernix/meteord:base' if your app is using Meteor 1.4 - 1.5
// image: 'abernix/meteord:node-8.4.0-base',
image: 'abernix/meteord:base',
},
// Show progress bar while uploading bundle to server
// You might need to disable it on CI servers
enableUploadProgressBar: true
},
mongo: {
version: '3.4.1',
servers: {
one: {}
}
},
// (Optional)
// Use the proxy to setup ssl or to route requests to the correct
// app when there are several apps
// proxy: {
// domains: 'mywebsite.com,www.mywebsite.com',
// ssl: {
// // Enable Let's Encrypt
// letsEncryptEmail: 'email@domain.com'
// }
// }
};
经过进一步检查,似乎有什么东西在强制根 url 到 HTTPS,我不确定这是怎么发生的。
更新:
我现在使用 Nginx 为我的文件提供服务,以解决此 https 问题。现在的问题是我只看到了 nginx 欢迎页面,我应该在那里看到我的应用程序。
这是我的 sites-enabled/configuration
server {
listen *:80;
server_name mysite.com;
access_log /var/log/nginx/app.dev.access.log;
error_log /var/log/nginx/app.dev.error.log;
location ~* "^/[a-z0-9]{40}\.(css|js)$" {
root /opt/appName/app/programs/web.browser;
access_log off;
expires max;
}
location ~ "^/packages" {
root /opt/appName/app/programs/web.browser/packages;
access_log off;
}
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header X-Forwarded-For $remote_addr;
}
}
在这里我可以看到 docker 个容器 运行。
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2e0124d3fb74 mup-mefleetclient:latest "/bin/sh -c 'bash $M…" 3 minutes ago Up 3 minutes 0.0.0.0:3000->80/tcp MyClient
b880f60e7758 mongo:3.4.1 "/entrypoint.sh mong…" 5 minutes ago Up 5 minutes 127.0.0.1:27017->27017/tcp mongodb
root@ip-172-31-4-125:/etc/nginx/sites-enabled#
这个问题的罪魁祸首是安装在项目上的名为 'force-ssl' 的 npm 包。删除包解决了问题,并且可以在线查看该项目。
我正在尝试使用 Meteor Up (mup) 将 Meteor 应用程序部署到 Amazon Web Services 实例。我遵循了本指南 https://sergelobatch.com/beginners-guide-to-deploying-a-meteor-app-to-an-aws-server-with-meteor-up/,到目前为止,它已经成功地帮助我解决了这个障碍。
Mup 设置和 Mup 部署都 运行 成功。通过浏览器访问 ip 后,我收到拒绝连接错误。
流星版本 1.5.4
更新 1.4.5
这是我的 mup.js
module.exports = {
servers: {
one: {
// TODO: set host address, username, and authentication method
host: '54.206.11.xx',
username: 'ubuntu',
pem: '~/.ssh/MyClient-Staging.pem'
// password: 'server-password'
// or neither for authenticate from ssh-agent
}
},
app: {
// TODO: change app name and path
name: 'MyClient',
path: '../',
servers: {
one: {},
},
buildOptions: {
serverOnly: true,
},
env: {
// TODO: Change to your app's url
// If you are using ssl, it needs to start with https://
ROOT_URL: 'http://54.206.11.xx',
MONGO_URL: 'mongodb://mongodb/meteor',
MONGO_OPLOG_URL: 'mongodb://mongodb/local',
},
docker: {
// change to 'abernix/meteord:base' if your app is using Meteor 1.4 - 1.5
// image: 'abernix/meteord:node-8.4.0-base',
image: 'abernix/meteord:base',
},
// Show progress bar while uploading bundle to server
// You might need to disable it on CI servers
enableUploadProgressBar: true
},
mongo: {
version: '3.4.1',
servers: {
one: {}
}
},
// (Optional)
// Use the proxy to setup ssl or to route requests to the correct
// app when there are several apps
// proxy: {
// domains: 'mywebsite.com,www.mywebsite.com',
// ssl: {
// // Enable Let's Encrypt
// letsEncryptEmail: 'email@domain.com'
// }
// }
};
经过进一步检查,似乎有什么东西在强制根 url 到 HTTPS,我不确定这是怎么发生的。
更新:
我现在使用 Nginx 为我的文件提供服务,以解决此 https 问题。现在的问题是我只看到了 nginx 欢迎页面,我应该在那里看到我的应用程序。
这是我的 sites-enabled/configuration
server {
listen *:80;
server_name mysite.com;
access_log /var/log/nginx/app.dev.access.log;
error_log /var/log/nginx/app.dev.error.log;
location ~* "^/[a-z0-9]{40}\.(css|js)$" {
root /opt/appName/app/programs/web.browser;
access_log off;
expires max;
}
location ~ "^/packages" {
root /opt/appName/app/programs/web.browser/packages;
access_log off;
}
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header X-Forwarded-For $remote_addr;
}
}
在这里我可以看到 docker 个容器 运行。
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2e0124d3fb74 mup-mefleetclient:latest "/bin/sh -c 'bash $M…" 3 minutes ago Up 3 minutes 0.0.0.0:3000->80/tcp MyClient
b880f60e7758 mongo:3.4.1 "/entrypoint.sh mong…" 5 minutes ago Up 5 minutes 127.0.0.1:27017->27017/tcp mongodb
root@ip-172-31-4-125:/etc/nginx/sites-enabled#
这个问题的罪魁祸首是安装在项目上的名为 'force-ssl' 的 npm 包。删除包解决了问题,并且可以在线查看该项目。