forked from maximzxc/nginx-buildpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding documentation for forcing ssl and for nextjs (heroku#68)
- Loading branch information
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
daemon off; | ||
#Heroku dynos have at least 4 cores. | ||
worker_processes <%= ENV['NGINX_WORKERS'] || 4 %>; | ||
|
||
events { | ||
use epoll; | ||
accept_mutex on; | ||
worker_connections <%= ENV['NGINX_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 <%= ENV['NGINX_ACCESS_LOG_PATH'] || 'logs/nginx/access.log' %> l2met; | ||
error_log <%= ENV['NGINX_ERROR_LOG_PATH'] || 'logs/nginx/error.log' %>; | ||
|
||
include mime.types; | ||
default_type application/octet-stream; | ||
sendfile on; | ||
|
||
#Must read the body in 5 seconds. | ||
client_body_timeout 5; | ||
|
||
server { | ||
listen <%= ENV["PORT"] %>; | ||
server_name _; | ||
keepalive_timeout 5; | ||
|
||
location / { | ||
|
||
if ($http_x_forwarded_proto != "https") { | ||
return 301 https://$host$request_uri; | ||
} | ||
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header Host $http_host; | ||
proxy_redirect off; | ||
proxy_pass http://localhost:3000; #next serve listens here and receives nginx requests | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters