# # http://weiyuai.cn, http://*.weiyuai.cn server { listen 80; listen [::]:80; root /var/www/html/weiyuai/; index index.html index.htm index.nginx-debian.html index.php; server_name weiyuai.cn *.weiyuai.cn; location / { # 匹配所有路径,并尝试首先提供文件,然后目录,最后回退到index.html try_files $uri $uri/ /index.html; # 这里应该指向根目录的index.html,而不是特定路径下的index.html } # 下载文件,不需要修改owner,修改了也没用,只需要修改nginx.conf的user为root即可 location /download/ { # alias /root/weiyuai/download/; alias /var/www/html/weiyuai/download/; charset utf-8; # 设置字符编码为UTF-8,解决中文乱码问题 autoindex on; autoindex_format html; #以html风格将目录展示在浏览器中 autoindex_exact_size off; #切换为 off 后,以可读的方式显示文件大小,单位为 KB、MB 或者 GB autoindex_localtime on; #以服务器的文件时间作为显示的时间 client_max_body_size 4048M; proxy_max_temp_file_size 4048M; proxy_send_timeout 600; #后端服务器数据回传时间(代理发送超时) proxy_read_timeout 600; #连接成功后,后端服务器响应时间(代理接收超时) #符合条件,直接下载 if ($request_filename ~* ^.*?\.(txt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx)$){ add_header Content-Disposition attachment; } } # 如果需要为每个子路径提供特定的index.html,您可以添加额外的location块 location /admin/ { try_files $uri $uri/ /admin/index.html; } location /agent/ { try_files $uri $uri/ /agent/index.html; } location /agenth5/ { try_files $uri $uri/ /agenth5/index.html; } location /chat/ { try_files $uri $uri/ /chat/index.html; } location /webrtc/ { try_files $uri $uri/ /webrtc/index.html; } location /ticket/ { try_files $uri $uri/ /ticket/index.html; } location /voc/ { try_files $uri $uri/ /voc/index.html; } location /frame/ { try_files $uri $uri/ /chat/index.html; } location /docs/ { try_files $uri $uri/ /docs/index.html; } location /apidocs/ { try_files $uri $uri/ /apidocs/index.html; } location /workflow/ { try_files $uri $uri/ /workflow/index.html; } location /notebase/ { try_files $uri $uri/ /notebase/index.html; } location /kanban/ { try_files $uri $uri/ /kanban/index.html; } location /demos/ { try_files $uri $uri/ /demos/index.html; } location /forum/ { try_files $uri $uri/ /forum/index.html; } location /reactdemo/ { try_files $uri $uri/ /reactdemo/index.html; } location /call/ { try_files $uri $uri/ /call/index.html; } location /ippbx/ { try_files $uri $uri/ /ippbx/index.html; } location /meet/ { try_files $uri $uri/ /meet/index.html; } location /meetadmin/ { try_files $uri $uri/ /meetadmin/index.html; } # 增加 /helpcenter/ 路径为多个帮助中心的路由,支持如下路径: # /helpcenter/1507155949694980 # /helpcenter/1507155949691234 # /helpcenter/category/1505866394140160.html # /helpcenter/article/1507154892730372.html # /helpcenter/search.html?kbUid=1502197804171580&content=13 location /helpcenter/ { try_files $uri $uri/ /helpcenter/index.html; } # 增加 /blog/ 路径为博客路由,替换wordpress: location /blog/ { try_files $uri $uri/ /blog/index.html; } # 增加/blog/路径为wordpress路由 # location /blog/ { # try_files $uri $uri/ /blog/index.php?$args; # 尝试提供文件或目录,否则回退到index.php # # 在这个location块内处理PHP文件 # location ~ ^/blog/.*\.php$ { # include snippets/fastcgi-php.conf; # fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; # 确保与您的PHP版本匹配 # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # # 其他可能的fastcgi参数可以在这里添加 # } # } # 增加/shop/路径为wordpress路由, 测试电商插件 location /shop/ { try_files $uri $uri/ /shop/index.php?$args; # 尝试提供文件或目录,否则回退到index.php # 在这个location块内处理PHP文件 location ~ ^/shop/.*\.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; # 确保与您的PHP版本匹配 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # 其他可能的fastcgi参数可以在这里添加 } } # 添加或修改以下location块,支持.php文件 location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; # 假设你使用的是PHP 8.3版本 } }