CRMEB/docker/nginx/vhost.conf
sugar1569 8a42db5089 fix(nginx): 修复宿主机端口映射下的跳转丢失问题
添加 absolute_redirect off 配置,并修正后台链接末尾斜杠,解决宿主机 8011 映射容器 80 时跳转丢失端口的问题
2026-09-23 16:34:28 +08:00

59 lines
1.7 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

server {
listen 80;
index index.php index.html;
server_name bz.crmeb.com;
client_max_body_size 100M;
root /var/www/public;
# 端口映射场景(宿主机 8011 -> 容器 80):目录补斜杠 301 使用相对 Location,
# 避免跳转后丢失宿主机映射端口
absolute_redirect off;
location / {
# try_files $uri /index.php$is_args$args;
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
error_log off;
access_log /dev/null;
}
location ~ .*\.(js|css)?$
{
expires 12h;
error_log off;
access_log /dev/null;
}
# 统一长连接网关:所有 WebSocket 业务共用一个入口(后台通知、客服聊天及后续新业务)
# 客户端通过 ?service= 参数区分目标业务,服务器只需配置此一处反代即可
location /ws {
proxy_pass http://crmeb_workerman:40001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass phpfpm:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}