have managed make node + nginx proxy setup on heroku work?
could you, please, tell me how have organized directories structure , files in each directory before doing "git push heroku master"? buildpack did use?
i getting message "push rejected, no cedar-supported app detected" every time "git push heroku master". have put "nginx.conf.erb" file in "/conf" directory.
thank you.
i have used node.js + nginx setup on heroku many projects. way, can have nginx handle serving static files, caching, proxying other servers, , proxying several node processes.
use multi-buildpack buildpack (https://github.com/ddollar/heroku-buildpack-multi).
allows specify .buildpacks file refers several buildpacks. in .buildpacks file, use default heroku node buildpack, , fork of nginx buildpack rebuilt include ssl support.
https://github.com/theoephraim/nginx-buildpack.git https://github.com/heroku/heroku-buildpack-nodejs.git the nginx buildpack uses nginx.conf.erb file can reference env vars. must tell listen on port specified heroku in environment variable called "port"
listen <%= env["port"] %>; then have node server start on whatever port choose, 5001, , in nginx config, can set proxy pass node app:
location / { proxy_pass http://127.0.0.1:5001; } note - procfile needs use special start-nginx command (part of nginx buildpack) calls whatever else pass it. in case use forever run node app:
web: bin/start-nginx ./node_modules/.bin/forever app.js and within main node file, must create file when has started signal nginx buildpack should begin listening
fs.opensync('/tmp/app-initialized', 'w'); there full explanation of how use nginx buildpack in readme @ https://github.com/theoephraim/nginx-buildpack
Comments
Post a Comment