我遇到 NGINX 配置问题。 我使用 Next.js 和 Strapi 开发了一个项目。该项目在单个 Ubuntu 服务器上的不同端口上运行。下面是我没有编写的 NGINX 代码,但它无法正常运行。
本地主机:3000 = Nextjs
本地主机:1337 = Strapi
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /admin {
proxy_pass http://localhost:1337;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
当我直接访问站点 URL 时,我会看到 Next.js 项目的主页。但是,当我进入 /admin 路径时,它显示 Strapi 的登录页面。但登录后,Strapi 面板无法打开,因为我无法导航到 /admin 下的 /admin/content-manager/ 等路径。我该如何解决这个问题?正确的重定向应该是什么样的?
如果您能提供帮助,我将不胜感激。
我也遇到同样的问题,请问可以回复吗?