即時通訊嘗試在heroku免費環境中啓動一個nginx服務器。我準備好了任何說明和教程,但我沒有得到它的運行。端口80上的heroku + nginx
首先,我想在端口80上啓動nginx作爲默認web服務器。之後我想配置nginx作爲下劃線express服務器(其他heroku實例)的代理。 4天我試着在我的heroku實例上只啓動nginx。我總是得到不允許在端口80上啓動的異常。 我從(https://github.com/benmurden/nginx-pagespeed-buildpack)分叉了nginx-buildback(https://github.com/moohkooh/nginx-buildpack)以調整某些配置。如果我通過端口2555上的heroku bash運行nginx,nginx正在啓動,但我在Web瀏覽器上拒絕了連接。
如果我通過測功機我越來越原木
State changed from starting to crashed
我迪諾
web: bin/start-nginx
我nginx.config.erb的Procfile
daemon off;
#Heroku dynos have at least 4 cores.
worker_processes <%= ENV['NGINX_WORKERS'] || 4 %>;
events {
use epoll;
accept_mutex on;
worker_connections 1024;
}
http {
gzip on;
gzip_comp_level 2;
gzip_min_length 512;
server_tokens off;
log_format l2met 'measure#nginx.service=$request_time request_id=$http_x_request_id';
access_log logs/nginx/access.log l2met;
error_log logs/nginx/error.log;
include mime.types;
default_type application/octet-stream;
sendfile on;
server {
listen <%= ENV['PORT'] %>;
server_name _;
keepalive_timeout 5;
root /app/www;
index index.html;
location/{
autoindex on;
}
}
}
我還錯誤消息nginx的開始將PORT變量設置爲80
heroku config:get PORT
80
其他一些配置:
heroku config:get NGINX_WORKERS
8
heroku buildpacks
https://github.com/heroku/heroku-buildpack-multi.git
heroku stack
cedar-14
我.buildpack文件
https://github.com/moohkooh/nginx-buildpack
https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/ruby.tgz
我也有猜測,認爲Heroku的不使用我的變量,我設置爲80。怎麼啦?非常感謝任何人。
順便說一句:我的快遞服務器上運行,而不在端口1000的任何錯誤(測試我開始還端口80上沒有任何錯誤)
您是否嘗試過不強迫端口爲80?我不更改端口,因爲Heroku設置它。 「每個Web進程都只是綁定到一個端口,並監聽進入該端口的請求,綁定的端口由Heroku指定爲PORT環境變量。」 - https://devcenter.heroku.com/articles/runtime-principles – adibble
是的,我在努力。 Heroku用一個「隨機」端口啓動nginx,但我也沒有通過瀏覽器進行響應。正如我讀到的,如果我將端口設置爲80,他們應該從端口80或端口設置環境啓動。 – moohkooh