mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 17:20:30 +08:00
153 lines
3.1 KiB
Nginx Configuration File
153 lines
3.1 KiB
Nginx Configuration File
user http;
|
|
worker_processes 4;
|
|
|
|
# error_log /tmp/nginx.error.log;
|
|
error_log stderr;
|
|
|
|
include /usr/share/kvmd/extras/*/nginx.ctx-main.conf;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
use epoll;
|
|
multi_accept on;
|
|
}
|
|
|
|
http {
|
|
access_log off;
|
|
|
|
include /etc/nginx/mime-types.conf;
|
|
default_type application/octet-stream;
|
|
charset utf-8;
|
|
|
|
absolute_redirect off;
|
|
index index.html;
|
|
|
|
sendfile on;
|
|
tcp_nodelay on;
|
|
tcp_nopush on;
|
|
keepalive_timeout 10;
|
|
client_max_body_size 4k;
|
|
|
|
client_body_temp_path /tmp/nginx.client_body_temp;
|
|
fastcgi_temp_path /tmp/nginx.fastcgi_temp;
|
|
proxy_temp_path /tmp/nginx.proxy_temp;
|
|
scgi_temp_path /tmp/nginx.scgi_temp;
|
|
uwsgi_temp_path /tmp/nginx.uwsgi_temp;
|
|
|
|
upstream kvmd {
|
|
server 127.0.0.1:8081 fail_timeout=0s max_fails=0;
|
|
}
|
|
|
|
upstream ustreamer {
|
|
server 127.0.0.1:8082 fail_timeout=0s max_fails=0;
|
|
}
|
|
|
|
include /usr/share/kvmd/extras/*/nginx.ctx-http.conf;
|
|
|
|
#PROD server {
|
|
#PROD listen 80;
|
|
#PROD server_name localhost;
|
|
#PROD return 301 https://$host$request_uri;
|
|
#PROD }
|
|
|
|
server {
|
|
#PROD listen 443 ssl http2;
|
|
server_name localhost;
|
|
#PROD include /etc/nginx/ssl.conf;
|
|
|
|
auth_request /auth;
|
|
|
|
location = /auth {
|
|
internal;
|
|
proxy_pass http://kvmd/auth/check;
|
|
proxy_pass_request_body off;
|
|
proxy_set_header Content-Length "";
|
|
auth_request off;
|
|
}
|
|
|
|
location / {
|
|
root /usr/share/kvmd/web;
|
|
include /etc/nginx/loc-login.conf;
|
|
include /etc/nginx/loc-nocache.conf;
|
|
}
|
|
|
|
location @login {
|
|
return 302 /login;
|
|
}
|
|
|
|
location /login {
|
|
root /usr/share/kvmd/web;
|
|
auth_request off;
|
|
}
|
|
|
|
location /share {
|
|
root /usr/share/kvmd/web;
|
|
auth_request off;
|
|
}
|
|
|
|
location = /favicon.ico {
|
|
alias /usr/share/kvmd/web/favicon.ico;
|
|
auth_request off;
|
|
}
|
|
|
|
location = /robots.txt {
|
|
alias /usr/share/kvmd/web/robots.txt;
|
|
auth_request off;
|
|
}
|
|
|
|
location /kvmd/ws {
|
|
rewrite ^/kvmd/ws$ /ws break;
|
|
rewrite ^/kvmd/ws\?(.*)$ /ws?$1 break;
|
|
proxy_pass http://kvmd;
|
|
include /etc/nginx/loc-proxy.conf;
|
|
include /etc/nginx/loc-websocket.conf;
|
|
auth_request off;
|
|
}
|
|
|
|
location /kvmd/msd/write {
|
|
rewrite ^/kvmd/msd/write$ /msd/write break;
|
|
rewrite ^/kvmd/msd/write\?(.*)$ /msd/write?$1 break;
|
|
proxy_pass http://kvmd;
|
|
include /etc/nginx/loc-proxy.conf;
|
|
limit_rate 6250k;
|
|
limit_rate_after 50k;
|
|
client_max_body_size 0;
|
|
proxy_request_buffering off;
|
|
auth_request off;
|
|
}
|
|
|
|
location /kvmd/log {
|
|
rewrite ^/kvmd/log$ /log break;
|
|
rewrite ^/kvmd/log\?(.*)$ /log?$1 break;
|
|
proxy_pass http://kvmd;
|
|
include /etc/nginx/loc-proxy.conf;
|
|
proxy_read_timeout 7d;
|
|
postpone_output 0;
|
|
proxy_buffering off;
|
|
proxy_ignore_headers X-Accel-Buffering;
|
|
auth_request off;
|
|
}
|
|
|
|
location /kvmd {
|
|
rewrite ^/kvmd$ / break;
|
|
rewrite ^/kvmd/(.*)$ /$1 break;
|
|
proxy_pass http://kvmd;
|
|
include /etc/nginx/loc-proxy.conf;
|
|
auth_request off;
|
|
}
|
|
|
|
location /streamer {
|
|
rewrite ^/streamer$ / break;
|
|
rewrite ^/streamer\?(.*)$ ?$1 break;
|
|
rewrite ^/streamer/(.*)$ /$1 break;
|
|
proxy_pass http://ustreamer;
|
|
include /etc/nginx/loc-proxy.conf;
|
|
postpone_output 0;
|
|
proxy_buffering off;
|
|
proxy_ignore_headers X-Accel-Buffering;
|
|
}
|
|
|
|
include /usr/share/kvmd/extras/*/nginx.ctx-server.conf;
|
|
}
|
|
}
|