96 lines
2.8 KiB
Plaintext
96 lines
2.8 KiB
Plaintext
user root;
|
|
worker_processes auto;
|
|
|
|
error_log /var/log/nginx/error.log notice;
|
|
pid /var/run/nginx.pid;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
# JTT808 TCP流转发配置
|
|
stream {
|
|
log_format basic '$remote_addr [$time_local] '
|
|
'$protocol $status $bytes_sent $bytes_received '
|
|
'$session_time "$upstream_addr" '
|
|
'"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';
|
|
|
|
access_log /var/log/nginx/jtt808_access.log basic;
|
|
error_log /var/log/nginx/jtt808_error.log;
|
|
|
|
# JTT808服务器后端
|
|
upstream jtt808_backend {
|
|
server 192.168.0.234:8808; # JTT808服务器地址和端口
|
|
#server 192.168.1.3:8808; # 如果有多台服务器可以配置负载均衡
|
|
}
|
|
|
|
# JTT808端口代理
|
|
server {
|
|
listen 21100; # 公网暴露的JTT808端口
|
|
proxy_pass jtt808_backend;
|
|
proxy_timeout 10s;
|
|
proxy_responses 1; # JTT808通常是一请求一响应
|
|
proxy_connect_timeout 5s;
|
|
proxy_bind $remote_addr transparent; # 保持客户端真实IP
|
|
}
|
|
}
|
|
|
|
# HTTP服务配置保持不变
|
|
http {
|
|
include mime.types;
|
|
default_type application/octet-stream;
|
|
server_tokens off;
|
|
|
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
|
|
|
sendfile on;
|
|
keepalive_timeout 65;
|
|
client_max_body_size 100M;
|
|
client_body_buffer_size 100M;
|
|
fastcgi_buffer_size 128k;
|
|
fastcgi_buffers 8 128k;
|
|
fastcgi_busy_buffers_size 128k;
|
|
fastcgi_temp_file_write_size 128k;
|
|
|
|
server {
|
|
listen 81;
|
|
server_name localhost;
|
|
charset utf-8;
|
|
|
|
location / {
|
|
root /usr/local/www/dist;
|
|
index index.html;
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
location /APP {
|
|
alias /usr/local/www/APP;
|
|
}
|
|
|
|
location /screen {
|
|
alias /usr/local/www/screen;
|
|
index index01.html;
|
|
try_files $uri $uri/ /screen/index01.html;
|
|
}
|
|
|
|
location /dev-api/ {
|
|
rewrite ^/dev-api/(.*)$ /$1 break;
|
|
proxy_pass http://192.168.1.2:39080/;
|
|
proxy_redirect off;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
}
|
|
|
|
location /bigScreen/ {
|
|
rewrite ^/bigScreen/(.*)$ /$1 break;
|
|
proxy_pass http://192.168.1.2:39080/;
|
|
proxy_redirect off;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
}
|
|
}
|
|
} |