企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
使用nginx做代理服务配置如下: ~~~ server{ listen 80 ; server_name 域名; #代理配置 location /{ proxy_set_header X-Original-Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:9501/; } } ~~~ - `:9501`是`config/swoole.php`中的`server['port']` - 配置完成后重启`nginx`即可 - 在项目根目录下执行`php think swoole start` - 访问域名即可看到响应结果. 以下是复制宝塔反向代理的配置文件内容 ~~~ #PROXY-START/ location ~* \.(php|jsp|cgi|asp|aspx)$ { proxy_pass http://127.0.0.7:9501; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; } location / { proxy_pass http://127.0.0.7:9501; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; add_header X-Cache $upstream_cache_status; #Set Nginx Cache add_header Cache-Control no-cache; expires 12h; } location /ws { proxy_connect_timeout 60; proxy_send_timeout 60; proxy_read_timeout 60; proxy_buffer_size 256k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k; proxy_temp_file_write_size 256k; proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_404; proxy_max_temp_file_size 128m; proxy_pass http://127.0.0.1:9501; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } #PROXY-END/ ~~~