Skip to content

Instantly share code, notes, and snippets.

@Hc747
Last active December 3, 2020 23:40
Show Gist options
  • Save Hc747/685c90c93cb6e4749edd85c0dc296e68 to your computer and use it in GitHub Desktop.
Save Hc747/685c90c93cb6e4749edd85c0dc296e68 to your computer and use it in GitHub Desktop.
daemon off;
worker_processes auto;
events {
use epoll;
accept_mutex on;
worker_connections 2048;
}
http {
gzip on;
gzip_comp_level 6;
gzip_min_length 512;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_vary on;
gzip_proxied any;
server_tokens off;
access_log logs/access.log;
error_log stderr error;
include mime.types;
default_type application/octet-stream;
sendfile on;
#Must read the body in 5 seconds.
client_body_timeout 5;
server {
listen 56817 reuseport;
charset UTF-8;
port_in_redirect off;
keepalive_timeout 5;
root build;
resolver 172.16.0.23 8.8.8.8;
mruby_post_read_handler /app/bin/config/lib/ngx_mruby/headers.rb cache;
location / {
mruby_set $fallback /app/bin/config/lib/ngx_mruby/routes_fallback.rb cache;
try_files $uri.html $uri $uri/ $fallback;
}
location ~ \.html$ {
try_files $uri =404;
}
location ~ ^/static/.*$ {
set $route /static/.*;
mruby_set $path /app/bin/config/lib/ngx_mruby/routes_path.rb cache;
mruby_set $fallback /app/bin/config/lib/ngx_mruby/routes_fallback.rb cache;
try_files $uri.html $uri $uri/ $path $fallback;
}
location ~ ^/.*$ {
set $route /.*;
mruby_set $path /app/bin/config/lib/ngx_mruby/routes_path.rb cache;
mruby_set $fallback /app/bin/config/lib/ngx_mruby/routes_fallback.rb cache;
try_files $uri.html $uri $uri/ $path $fallback;
}
# need this b/c setting $fallback to =404 will try #{root}=404 instead of returning a 404
location @404 {
return 404;
}
# fallback proxy named match
set $upstream_endpoint_0 ;
location @/api/ {
rewrite ^/api//?(.*)$ www.example.com/$1 break;
# can reuse variable set above
proxy_pass $upstream_endpoint_0;
proxy_ssl_server_name on;
proxy_redirect http:www.example.com/ /api/;
proxy_redirect https:www.example.com/ /api/;
}
# fallback redirects named match
}
}
{
"root": "build",
"encoding": "UTF-8",
"https_only": true,
"clean_urls": true,
"routes": {
"/static/**": "/static/",
"/**": "index.html"
},
"proxies": {
"/api/": {
"origin": "www.example.com"
}
}
}
Last login: Fri Dec 4 10:17:27 on ttys001
heroku run bash% hcole@uac-support-mac ~ % heroku run bash -a oa-heroku20
Running bash on ⬢ oa-heroku20... up, run.8734 (Free)
~ $ bin/boot &
[1] 10
~ $ Starting log redirection...
Starting nginx...
nginx: [emerg] invalid number of arguments in "set" directive in ./config/nginx.conf:94
Process exited unexpectedly: nginx
Going down, terminating child processes...
cat /app/config/nginx.conf
daemon off;
worker_processes auto;
events {
use epoll;
accept_mutex on;
worker_connections 2048;
}
http {
gzip on;
gzip_comp_level 6;
gzip_min_length 512;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_vary on;
gzip_proxied any;
server_tokens off;
access_log logs/access.log;
error_log stderr error;
include mime.types;
default_type application/octet-stream;
sendfile on;
#Must read the body in 5 seconds.
client_body_timeout 5;
server {
listen 56817 reuseport;
charset UTF-8;
port_in_redirect off;
keepalive_timeout 5;
root build;
resolver 172.16.0.23 8.8.8.8;
mruby_post_read_handler /app/bin/config/lib/ngx_mruby/headers.rb cache;
location / {
mruby_set $fallback /app/bin/config/lib/ngx_mruby/routes_fallback.rb cache;
try_files $uri.html $uri $uri/ $fallback;
}
location ~ \.html$ {
try_files $uri =404;
}
location ~ ^/static/.*$ {
set $route /static/.*;
mruby_set $path /app/bin/config/lib/ngx_mruby/routes_path.rb cache;
mruby_set $fallback /app/bin/config/lib/ngx_mruby/routes_fallback.rb cache;
try_files $uri.html $uri $uri/ $path $fallback;
}
location ~ ^/.*$ {
set $route /.*;
mruby_set $path /app/bin/config/lib/ngx_mruby/routes_path.rb cache;
mruby_set $fallback /app/bin/config/lib/ngx_mruby/routes_fallback.rb cache;
try_files $uri.html $uri $uri/ $path $fallback;
}
# need this b/c setting $fallback to =404 will try #{root}=404 instead of returning a 404
location @404 {
return 404;
}
# fallback proxy named match
set $upstream_endpoint_0 ;
location @/api/ {
rewrite ^/api//?(.*)$ www.example.com/$1 break;
# can reuse variable set above
proxy_pass $upstream_endpoint_0;
proxy_ssl_server_name on;
proxy_redirect http:www.example.com/ /api/;
proxy_redirect https:www.example.com/ /api/;
}
# fallback redirects named match
}
}
[1]+ Exit 1 bin/boot
~ $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment