We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
我想请教下,在第一个配置(我认为是http)和websocket服务器下的配置有什么区别呢? 在websocket下配置nginx,无法访问public下的静态资源文件,配置内容是直接粘贴的。 而且在第一个配置下也是可以用websocket的呀
The text was updated successfully, but these errors were encountered:
Nginx既可以写两配置 单独代理Http与WebSocket,也可以合并在一起,具体看开发者是否需要分域名独立配置。访问静态资源,直接使用try_files指令即可。
Nginx
Http
WebSocket
try_files
map $http_upgrade $connection_upgrade { default upgrade; '' close; } upstream laravels-ws { server 192.168.0.1:8011 weight=5 max_fails=3 fail_timeout=30s; #server 192.168.0.2:5200 weight=3 max_fails=3 fail_timeout=30s; #server 192.168.0.3:5200 backup; } server { listen 80; server_name laravels-ws.com; root /xxxpath/laravel-s-test/public; access_log /xxpath/log/nginx/$server_name.access.log main; location / { try_files $uri @laravels; } location @laravels { proxy_http_version 1.1; # proxy_connect_timeout 60s; # proxy_send_timeout 60s; # proxy_read_timeout 60s; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-PORT $remote_port; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_pass http://laravels-ws; } }
Sorry, something went wrong.
懂了。。但是websocket也是可以当作http代理的,懂了懂了 谢谢 还是了解的不够
hhxsv5
No branches or pull requests
我想请教下,在第一个配置(我认为是http)和websocket服务器下的配置有什么区别呢?
在websocket下配置nginx,无法访问public下的静态资源文件,配置内容是直接粘贴的。
而且在第一个配置下也是可以用websocket的呀
The text was updated successfully, but these errors were encountered: