【发布时间】:2015-01-19 09:22:21
【问题描述】:
centos7如何部署meteor。我们安装了meteor和meteorjs包和nodejs。 但是我们无法打开制作链接。请帮助我。
【问题讨论】:
centos7如何部署meteor。我们安装了meteor和meteorjs包和nodejs。 但是我们无法打开制作链接。请帮助我。
【问题讨论】:
您应该使用“meteor build --directory”命令构建您的应用程序。使用此命令,您将获得一个捆绑目录。压缩该捆绑文件夹并将其上传到服务器。示例
meteor build --directory <some_path>
在服务器上解压,然后
cd bundle/programs/server
npm install
supervisord.conf 文件中的示例流星应用程序配置。所有流星应用程序特定的配置都在此配置的“环境”变量中。您的 supervisord.conf 文件中还会有其他条目。您必须为您的流星应用程序添加这个。有关 supervisord 的更多信息,请访问http://supervisord.org
[program:my-meteor-app]
command=node main.js ; the program (relative uses PATH, can take args)
directory=/home/path_where_bundle_is/bundle
process_name=%(program_name)s ; process_name expr (default %(program_name)s)
numprocs=1 ; number of processes copies to start (def 1)
autostart=true ; start at supervisord start (default: true)
autorestart=unexpected ; whether/when to restart (default: unexpected)
user=app_user ; setuid to this UNIX account to run the program
redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/meteor.log ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
;stdout_events_enabled=false ; emit events on stdout writes (default false)
stderr_logfile=/var/log/meteor_err.log ; stderr log path, NONE for none; default AUTO
stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
stderr_logfile_backups=10 ; # of stderr logfile backups (default 10)
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
;stderr_events_enabled=false ; emit events on stderr writes (default false)
environment=PORT="3003", ROOT_URL="https://your_url",MAIL_URL="smtp://xxx:xxx@smtp.mailgun.org:25",MONGO_URL="mongodb://xxx:xxx@localhost/databasename" ; process environment additions (def no adds)
;serverurl=AUTO ; override serverurl computation (childutils)
对于 nginx 配置,这是我关于流星应用程序的配置(这不是整个配置文件,只是流星所需的部分):
location / {
proxy_pass http://localhost:3003/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
}
有关设置 nginx 的更多详细信息,您可以查看 digitalocean 文档: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-meteor-js-application-on-ubuntu-14-04-with-nginx
一切正常时:
supervisorctl start all
service nginx start
我正在端口 3003 上运行流星应用程序,并使用 nginx 将请求重定向到该端口。您可能需要添加一个 iptables 规则来断开到端口 3003 的连接,这样只有 nginx 可以连接到端口 3003。这里有两个 iptables 规则来拒绝来自公共网络的 mongodb 和端口 3003 连接。
iptables -A INPUT -i eth0 -p tcp -m tcp --dport 27017 -j DROP
iptables -A INPUT -i eth0 -p tcp -m tcp --dport 3003 -j DROP
【讨论】:
location /app {...} 时,它会向我显示我的应用程序的 404 页面。一个主意?谢谢