ToolJet/deploy/ec2/nginx.conf
Ashish 80d5ec536d
Chore: change location rule in nginx conf (#320)
* change location rule in nginx conf; enable std out logging

* use packer variables to set ami name, instance type and ami region
2021-06-25 21:43:38 +05:30

114 lines
1.9 KiB
Nginx Configuration File

user www-data;
worker_processes auto;
pid /usr/local/openresty/nginx/logs/nginx.pid;
events
{
worker_connections 1024;
}
http
{
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
access_log /var/log/openresty/access.log;
error_log /var/log/openresty/error.log;
gzip on;
gzip_disable "msie6";
lua_shared_dict auto_ssl 1m;
lua_shared_dict auto_ssl_settings 64k;
resolver 8.8.8.8 ipv6=off;
init_by_lua_block
{
auto_ssl = (require "resty.auto-ssl").new()
auto_ssl:set("allow_domain", function(domain)
return true
end)
auto_ssl:init()
}
init_worker_by_lua_block
{
auto_ssl:init_worker()
}
server
{
listen 443 ssl;
ssl_certificate_by_lua_block
{
auto_ssl:ssl_certificate()
}
ssl_certificate /etc/ssl/resty-auto-ssl-fallback.crt;
ssl_certificate_key /etc/ssl/resty-auto-ssl-fallback.key;
location /
{
root /home/ubuntu/app/frontend/build;
try_files $uri $uri/ /index.html;
}
location /_backend_
{
rewrite /_backend_/(.*) /$1 break;
proxy_pass http://localhost:3000;
proxy_redirect off;
proxy_set_header Host $host;
}
}
server
{
listen 80;
location /.well-known/acme-challenge/
{
content_by_lua_block
{
auto_ssl:challenge_server()
}
}
location /
{
root /home/ubuntu/app/frontend/build;
try_files $uri $uri/ /index.html;
}
location /_backend_
{
rewrite /_backend_/(.*) /$1 break;
proxy_pass http://localhost:3000;
proxy_redirect off;
proxy_set_header Host $host;
}
}
server
{
listen 127.0.0.1:8999;
client_body_buffer_size 128k;
client_max_body_size 128k;
location /
{
content_by_lua_block
{
auto_ssl:hook_server()
}
}
}
}