add nginx.conf

This commit is contained in:
Ulric Qin 2020-09-26 22:58:14 +08:00
parent 4ec1086fc9
commit 4197cfba98
1 changed files with 155 additions and 0 deletions

155
etc/nginx.conf Normal file
View File

@ -0,0 +1,155 @@
user root;
worker_processes auto;
worker_cpu_affinity auto;
worker_rlimit_nofile 204800;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
use epoll;
worker_connections 204800;
}
http {
log_format main '$server_addr $host $remote_addr [$time_local] $scheme "$request" '
'$status $upstream_status $body_bytes_sent $request_time $upstream_addr $upstream_response_time "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
proxy_connect_timeout 500ms;
proxy_send_timeout 1000ms;
proxy_read_timeout 3000ms;
proxy_buffers 64 8k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 64k;
proxy_redirect off;
proxy_next_upstream error invalid_header timeout http_502 http_504;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Port $remote_port;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100m;
client_body_buffer_size 512k;
client_body_timeout 180;
client_header_timeout 10;
send_timeout 240;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_comp_level 2;
gzip_types application/javascript application/x-javascript text/css text/javascript image/jpeg image/gif image/png;
gzip_vary off;
gzip_disable "MSIE [1-6]\.";
upstream n9e.rdb {
server 127.0.0.1:8000;
keepalive 60;
}
upstream n9e.ams {
server 127.0.0.1:8002;
keepalive 60;
}
upstream n9e.job {
server 127.0.0.1:8004;
keepalive 60;
}
upstream n9e.monapi {
server 127.0.0.1:8006;
keepalive 60;
}
upstream n9e.transfer {
server 127.0.0.1:8008;
keepalive 60;
}
upstream n9e.index {
server 127.0.0.1:8012;
keepalive 60;
}
server {
listen 80 default_server;
server_name n9e.example.com;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location =/ {
rewrite / /mon;
}
location /rdb {
root /home/n9e/pub;
index index.html;
try_files $uri /rdb/index.html;
}
location /ams {
root /home/n9e/pub;
index index.html;
try_files $uri /ams/index.html;
}
location /job {
root /home/n9e/pub;
index index.html;
try_files $uri /job/index.html;
}
location /mon {
root /home/n9e/pub;
index index.html;
try_files $uri /mon/index.html;
}
location /api/rdb {
proxy_pass http://n9e.rdb;
}
location /api/ams {
proxy_pass http://n9e.ams;
}
location /api/job {
proxy_pass http://n9e.job;
}
location /api/mon {
proxy_pass http://n9e.monapi;
}
location /api/index {
proxy_pass http://n9e.index;
}
location /api/transfer {
proxy_pass http://n9e.transfer;
}
}
}