GithubHelp home page GithubHelp logo

ws connection return 404 about laravel-s HOT 10 CLOSED

hhxsv5 avatar hhxsv5 commented on May 6, 2024
ws connection return 404

from laravel-s.

Comments (10)

hhxsv5 avatar hhxsv5 commented on May 6, 2024

Do you follow this steps Enable Websocket ?

from laravel-s.

Wqw9550 avatar Wqw9550 commented on May 6, 2024

我代码是粘贴到 app/Service/WebsocketService.php 这个文件里的,laravels.php也是按照文档配置的

from laravel-s.

hhxsv5 avatar hhxsv5 commented on May 6, 2024

Nginx配置贴出来看看

from laravel-s.

Wqw9550 avatar Wqw9550 commented on May 6, 2024

map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream laravels {
server 127.0.0.1:5200 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 443;
server_name wqw.hfvi.cn;
ssl on;
ssl_certificate /usr/local/etc/nginx/servers/sslkey/wqw.hfvi.cn_ssl.crt;
ssl_certificate_key /usr/local/etc/nginx/servers/sslkey/wqw.hfvi.cn_ssl.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
ssl_prefer_server_ciphers on;
root /Users/michael/htdocs/laravel/public;
access_log /Users/michael/htdocs/log/nginx/$server_name.access.log main;
index index.html index.htm;
# Nginx handles the static resources(recommend enabling gzip), LaravelS handles the dynamic resource.
location / {
try_files $uri @laravels;
}
# Response 404 directly when request the PHP file, to avoid exposing public/*.php
#location ~* .php$ {
# return 404;
#}
# Http and Websocket are concomitant, Nginx identifies them by "location"
# Javascript: var ws = new WebSocket("ws://laravels.com/ws");
location =/ws {
proxy_http_version 1.1;
# proxy_connect_timeout 60s;
# proxy_send_timeout 60s;
# proxy_read_timeout: Nginx will close the connection if client does not send data to server in 60 seconds; At the same time, this close behavior is also affected by heartbeat setting of Swoole
# 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 $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header Server-Protocol $server_protocol;
proxy_set_header Server-Name $server_name;
proxy_set_header Server-Addr $server_addr;
proxy_set_header Server-Port $server_port;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_pass http://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 $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header Server-Protocol $server_protocol;
proxy_set_header Server-Name $server_name;
proxy_set_header Server-Addr $server_addr;
proxy_set_header Server-Port $server_port;
proxy_pass http://laravels;
}
}

from laravel-s.

hhxsv5 avatar hhxsv5 commented on May 6, 2024

Nginx配置没问题,注释掉ssl,用ws试试看看。

from laravel-s.

hhxsv5 avatar hhxsv5 commented on May 6, 2024

Nginx重启了吗?

nginx -s reload

from laravel-s.

Wqw9550 avatar Wqw9550 commented on May 6, 2024

清理缓存后就好了,谢谢,这个破谷歌浏览器,一点都不让我省心。

from laravel-s.

hhxsv5 avatar hhxsv5 commented on May 6, 2024

😓

from laravel-s.

Wqw9550 avatar Wqw9550 commented on May 6, 2024

上次也是瞎跳转,排查了这么久,谢谢你

from laravel-s.

hhxsv5 avatar hhxsv5 commented on May 6, 2024

没事,踩坑积攒经验。

from laravel-s.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.