You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Nginx仅首页可正常访问,其他路径均返回404的问题求助

Nginx仅首页可正常访问,其他路径均返回404的问题求助

大家好,我碰到了一个Nginx配置的棘手问题,想请教下各位大佬:

我的服务器运行着NGINX,访问DOMAIN.org时首页能正常加载展示,但访问任何其他路径(比如DOMAIN.org/path1)时,NGINX都会返回标准的404页面。

我的Nginx配置文件路径是/etc/nginx/sites-enabled/default,内容如下:

server {

listen 80 default_server;
listen [::]:80 default_server;

# root /var/www/html;
root /var/www/clients/client0/web1/web;

# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;

server_name _;

location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ =404;

    proxy_pass http://IP:8090;
    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 X-Forwarded-Proto $scheme;
}

}

我试过把proxy_pass http://IP:8090;改成proxy_pass http://IP:8090/;,但两种写法的结果完全一样,其他路径还是返回404。

有没有大佬知道这是哪里出问题了?万分感谢!

备注:内容来源于stack exchange,提问作者IHateCoding

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.20 09:22:59