Closed wmHappy closed 2 years ago
配置文件贴一下
worker_processes 4;
events { worker_connections 102400; accept_mutex on; multi_accept on;
}
http { include mime.types; default_type application/octet-stream;
access_log off; sendfile on; tcp_nopush on;
keepalive_timeout 55;
tcp_nodelay on; client_header_buffer_size 4k; client_body_buffer_size 512k; open_file_cache max=102400 inactive=20s; open_file_cache_valid 30s; open_file_cache_min_uses 1; client_header_timeout 15; client_body_timeout 15; reset_timedout_connection on; send_timeout 15; server_tokens off; client_max_body_size 50m;
proxy_connect_timeout 5; proxy_read_timeout 60; proxy_send_timeout 5; proxy_buffer_size 16k; proxy_buffers 4 64k; proxy_busy_buffers_size 128k; proxy_temp_file_write_size 128k;
gzip on; gzip_min_length 1k; gzip_buffers 4 16k;
gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; gzip_vary off; gzip_disable "MSIE [1-6]."; map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { listen 80; server_name localhost;
location /{
root "D:/Program Files/Nginx/nginx-1.16.1/html/";
index index.html;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
}
location /niudu{
proxy_pass http://localhost:8887;
}
location /fish{
proxy_pass http://localhost:8890;
}
location /userApi{
proxy_pass http://localhost:8080;
}
location /matchApi{
proxy_pass http://localhost:8081;
}
location /roomApi{
proxy_pass http://localhost:8082;
}
location /user {
proxy_pass http://127.0.0.1:3001;
proxy_http_version 1.1;
proxy_read_timeout 3600s;
proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Connection keep-alive;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /match {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_read_timeout 3600s;
proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Connection keep-alive;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /room {
proxy_pass http://127.0.0.1:3002;
proxy_http_version 1.1;
proxy_read_timeout 3600s;
proxy_redirect off;
proxy_set_header Connection keep-alive;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~* \.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ {
ssi on;
ssi_silent_errors on;
root "D:/Program Files/Nginx/nginx-1.16.1/html/";
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
#index index1.html;
#cache
expires 7d;
}
} }
不好意思 问题找到了 是websocket连接的url地址 和发送的消息协议 不是同一个 也就是连接的匹配服务url 然后用了房间服务的serviceProto 发送了房间服务的消息内容 感谢作者您写的开源tsrpc 用起来很方便
Invalid request buffer, please check the version of service proto.