152 lines
4.7 KiB
Nginx Configuration File
152 lines
4.7 KiB
Nginx Configuration File
|
|
#user nobody;
|
|
worker_processes 1;
|
|
|
|
#error_log logs/error.log;
|
|
#error_log logs/error.log notice;
|
|
#error_log logs/error.log info;
|
|
|
|
#pid logs/nginx.pid;
|
|
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
|
|
http {
|
|
include mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
log_format custom_log_format '$remote_addr - $remote_user [$time_local] "$request" '
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
'"$http_user_agent" "$http_x_forwarded_for" '
|
|
'rt=$request_time ut=$upstream_response_time';
|
|
|
|
access_log /var/log/nginx/access.log custom_log_format;
|
|
error_log /var/log/nginx/error.log info;
|
|
|
|
sendfile on;
|
|
#tcp_nopush on;
|
|
|
|
#keepalive_timeout 0;
|
|
keepalive_timeout 65;
|
|
|
|
client_max_body_size 16M;
|
|
|
|
#gzip on;
|
|
|
|
client_header_buffer_size 4k;
|
|
large_client_header_buffers 4 8k;
|
|
|
|
server {
|
|
listen 80;
|
|
listen 8080;
|
|
server_name ${NGINX_SERVER_NAME};
|
|
|
|
#charset koi8-r;
|
|
|
|
#access_log logs/host.access.log main;
|
|
|
|
location / {
|
|
root /etc/nginx/public;
|
|
index index.html index.htm;
|
|
}
|
|
|
|
location /reset {
|
|
rewrite ^/reset(.*)$ /admin/reset$1 permanent;
|
|
}
|
|
|
|
location /static/ {
|
|
alias /etc/nginx/static/;
|
|
}
|
|
|
|
#error_page 404 /404.html;
|
|
|
|
# redirect server error pages to the static page /50x.html
|
|
#
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root /etc/nginx/public;
|
|
}
|
|
|
|
location /chat/ {
|
|
proxy_pass http://eveai_chat:5002/;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_buffering off;
|
|
}
|
|
|
|
location /admin/ {
|
|
# include uwsgi_params;
|
|
# uwsgi_pass 127.0.0.1:5001;
|
|
# uwsgi_read_timeout 300;
|
|
proxy_pass http://eveai_app:5001/;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Forwarded-Prefix /admin; # Required for Flask views (used in nginx_utils
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
proxy_buffering off;
|
|
proxy_buffer_size 16k;
|
|
proxy_buffers 4 32k;
|
|
proxy_busy_buffers_size 64k;
|
|
|
|
# # Ensure these headers are set for secure connections
|
|
# proxy_set_header X-Forwarded-Proto $scheme;
|
|
# proxy_set_header X-Forwarded-Host $host;
|
|
# proxy_set_header X-Forwarded-Port $server_port;
|
|
|
|
proxy_connect_timeout 60s;
|
|
proxy_send_timeout 60s;
|
|
proxy_read_timeout 60s;
|
|
send_timeout 60s;
|
|
|
|
# Subfilter to hide admin prefix from app
|
|
sub_filter_once off;
|
|
sub_filter_types text/html text/css application/javascript;
|
|
|
|
# General HTML sub_filters
|
|
sub_filter 'href="/static/' 'href="/static/';
|
|
sub_filter 'src="/static/' 'src="/static/';
|
|
sub_filter 'url("/static/' 'url("/static/';
|
|
sub_filter 'href="/' 'href="/admin/'; # Rewrites for other content
|
|
sub_filter 'src="/' 'src="/admin/';
|
|
sub_filter 'action="/' 'action="/admin/';
|
|
sub_filter 'url("/' 'url("/admin/';
|
|
|
|
# Sub_filters for JavaScript URLs
|
|
sub_filter 'url: "/' 'url: "/admin/';
|
|
sub_filter 'url: \"/' 'url: "/admin/';
|
|
sub_filter 'url("/' 'url("/admin/';
|
|
sub_filter 'url(\\"/' 'url("/admin/';
|
|
|
|
# Sub_filters for AJAX requests
|
|
sub_filter 'url: \'/user/' 'url: \'/admin/user/';
|
|
sub_filter 'url: "/user/' 'url: "/admin/user/';
|
|
sub_filter 'url: "/api/' 'url: "/admin/api/';
|
|
sub_filter 'url: \'/api/' 'url: \'/admin/api/';
|
|
|
|
}
|
|
|
|
location /flower/ {
|
|
proxy_pass http://127.0.0.1:5555/;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
}
|
|
|
|
}
|
|
|
|
include sites-enabled/*;
|
|
}
|