Laradock에서 Laravel Octane 및 WebSocket의 nginx 구성 공유
Feb 14, 2023 am 11:20 AM
laravel
laradock
이 기사는 Laravel Octane 및 WebSocket의 nginx 구성을 주로 기록하면서 Laravel에 대한 관련 지식을 제공합니다. 관심 있는 분들은 아래를 살펴보시기 바랍니다.
laradock의 docker 설치, Laravel Octane 설치에 대해서는 여기서 자세히 설명하지 않겠습니다.
docker 安装laradock,和Laravel Octane的安装这里就不过多赘述了。
前情描述
在laradock
中安装好Laravel Octane后swoole启动,在nginx中配置端口访问连接失败, 报错提示502,配置如下:
location /octane { proxy_pass http://127.0.0.1:8080;}
로그인 후 복사
原因:Swoole服务器在Workspace容器中运行;Nginx服务器在Nginx容器中运行,需要找到Workspace的ip并在nginx中配置。
解决方法
docker ps
查看Workspace容器的id。docker inspect 容器id
,找到Networks
中的IPAddress
이전 설명-
laradock
에 Laravel Octane을 설치한 후 swoole이 시작됩니다. nginx에서 포트 액세스 연결 구성이 실패하고 오류 메시지 502가 보고됩니다.
map $http_upgrade $connection_upgrade { default upgrade; '' close;}
로그인 후 복사
docker ps
Workspace 컨테이너의 ID를 봅니다. 🎜🎜🎜nginx 구성 파일을 수정합니다. 🎜upstream ws { server 172.22.0.4:9502 weight=5 max_fails=3 fail_timeout=30s;}
로그인 후 복사
location /ws { set $suffix ""; if ($uri = /index.php) { set $suffix ?$query_string; } proxy_http_version 1.1; proxy_set_header Host $http_host; proxy_set_header Scheme $scheme; proxy_set_header SERVER_PORT $server_port; proxy_set_header REMOTE_ADDR $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_pass http://ws$suffix;}
로그인 후 복사
map $http_upgrade $connection_upgrade { default upgrade; '' close;}upstream ws { server 172.22.0.4:9502 weight=5 max_fails=3 fail_timeout=30s;}server { listen 80; listen [::]:80; server_name bbs.test; root /var/www/laravel/public; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php$is_args$args; } location ~ \.php$ { try_files $uri /index.php =404; fastcgi_pass php-upstream; fastcgi_index index.php; fastcgi_buffers 16 16k; fastcgi_buffer_size 32k; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #fixes timeouts fastcgi_read_timeout 600; include fastcgi_params; } location ~ /\.ht { deny all; } location /.well-known/acme-challenge/ { root /var/www/letsencrypt/; log_not_found off; } location /ws { set $suffix ""; if ($uri = /index.php) { set $suffix ?$query_string; } proxy_http_version 1.1; proxy_set_header Host $http_host; proxy_set_header Scheme $scheme; proxy_set_header SERVER_PORT $server_port; proxy_set_header REMOTE_ADDR $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_pass http://ws$suffix; } error_log /var/log/nginx/laravel_error.log; access_log /var/log/nginx/laravel_access.log;}
로그인 후 복사
위 내용은 Laradock에서 Laravel Octane 및 WebSocket의 nginx 구성 공유의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

인기 기사
Repo : 팀원을 부활시키는 방법
3 몇 주 전
By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
1 몇 주 전
By 尊渡假赌尊渡假赌尊渡假赌
헬로 키티 아일랜드 어드벤처 : 거대한 씨앗을 얻는 방법
3 몇 주 전
By 尊渡假赌尊渡假赌尊渡假赌
스플릿 소설을이기는 데 얼마나 걸립니까?
3 몇 주 전
By DDD

인기 기사
Repo : 팀원을 부활시키는 방법
3 몇 주 전
By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
1 몇 주 전
By 尊渡假赌尊渡假赌尊渡假赌
헬로 키티 아일랜드 어드벤처 : 거대한 씨앗을 얻는 방법
3 몇 주 전
By 尊渡假赌尊渡假赌尊渡假赌
스플릿 소설을이기는 데 얼마나 걸립니까?
3 몇 주 전
By DDD

뜨거운 기사 태그

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제
Gmail 이메일의 로그인 입구는 어디에 있나요?
7299
9


자바 튜토리얼
1622
14


Cakephp 튜토리얼
1342
46


라라벨 튜토리얼
1259
25


PHP 튜토리얼
1206
29



PHP에서 ORM(객체 관계형 매핑)을 사용하여 데이터베이스 작업을 단순화하는 방법은 무엇입니까?

Laravel과 CodeIgniter의 데이터 처리 기능은 어떻게 비교됩니까?
