Redo frontend and dockerfile to use nginx and build in stages based on prod steps in romm
This commit is contained in:
88
nginx.conf
Normal file
88
nginx.conf
Normal file
@@ -0,0 +1,88 @@
|
||||
load_module modules/ngx_http_js_module.so;
|
||||
load_module modules/ngx_http_zip_module.so;
|
||||
|
||||
worker_processes auto;
|
||||
pid /tmp/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 768;
|
||||
multi_accept on;
|
||||
}
|
||||
|
||||
http {
|
||||
client_body_temp_path /tmp/client_body 1 2;
|
||||
fastcgi_temp_path /tmp/fastcgi 1 2;
|
||||
proxy_temp_path /tmp/proxy;
|
||||
uwsgi_temp_path /tmp/uwsgi;
|
||||
scgi_temp_path /tmp/scgi;
|
||||
|
||||
sendfile on;
|
||||
client_body_buffer_size 128k;
|
||||
client_max_body_size 0;
|
||||
client_header_buffer_size 1k;
|
||||
large_client_header_buffers 4 16k;
|
||||
send_timeout 600s;
|
||||
keepalive_timeout 600s;
|
||||
client_body_timeout 600s;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
js_import /etc/nginx/js/decode.js;
|
||||
|
||||
map $time_iso8601 $date {
|
||||
~([^+]+)T $1;
|
||||
}
|
||||
map $time_iso8601 $time {
|
||||
~T([0-9:]+)\+ $1;
|
||||
}
|
||||
|
||||
# Map to extract the browser name (e.g., Chrome, Firefox, etc.)
|
||||
map $http_user_agent $browser {
|
||||
default "Unknown";
|
||||
"~Chrome/" "Chrome";
|
||||
"~Firefox/" "Firefox";
|
||||
"~Safari/" "Safari";
|
||||
"~Edge/" "Edge";
|
||||
"~Opera/" "Opera";
|
||||
}
|
||||
|
||||
# Map to extract the OS (e.g., Windows, MacOS, Linux)
|
||||
map $http_user_agent $os {
|
||||
default "Unknown";
|
||||
"~Windows NT" "Windows";
|
||||
"~Macintosh" "macOS";
|
||||
"~Linux" "Linux";
|
||||
"~Android" "Android";
|
||||
"~iPhone" "iOS";
|
||||
}
|
||||
|
||||
#INFO: [nginx][2023-11-14 09:20:29] 127.0.0.1 - -"GET / HTTP/1.1" 500 177 "-" "Mozilla/5.0 (X11; Linux x86_64)"rt=0.000 uct="-" uht="-" urt="-"
|
||||
log_format romm_logs 'INFO: [RomM][nginx][$date $time] '
|
||||
'$remote_addr | $http_x_forwarded_for | '
|
||||
'$request_method $request_uri $status | $body_bytes_sent | '
|
||||
'$browser $os | $request_time';
|
||||
|
||||
access_log /dev/stdout romm_logs;
|
||||
error_log /dev/stderr;
|
||||
|
||||
gzip on;
|
||||
gzip_proxied any;
|
||||
gzip_vary on;
|
||||
gzip_comp_level 6;
|
||||
gzip_buffers 16 8k;
|
||||
gzip_min_length 1024;
|
||||
gzip_http_version 1.1;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
|
||||
upstream backend_server {
|
||||
server 127.0.0.1:5000;
|
||||
}
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
||||
Reference in New Issue
Block a user