I am experiencing an issue with NGINX configuration. I have developed a project using Next.js and Strapi. This project runs on a single Ubuntu server on different ports. Below is the NGINX code that I did not write, but it is not functioning correctly.
localhost:3000 = Nextjs
localhost: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;
}
}
When I directly access the site URL, I see the homepage of the Next.js project. However, when I go to /admin route, it displays the login page of Strapi. But after logging in, the Strapi panel does not open because I cannot navigate to paths like /admin/content-manager/ under /admin. How can I resolve this issue? What should the correct redirection be like?
If you can help, I would greatly appreciate it.