admin 管理员组文章数量: 1086019
English is not my native language.
I have three Next.js apps, each with their own static file directory(.next
) and I want to config Nginx the way it find the required static files.
here is my current Nginx config.
location /_next {
alias /.../users-front/.next;
}
location /fonts {
alias /.../users-front/public/fonts;
}
location /{
include proxy_params;
#proxy_pass http://unix:/run/gunicorn.sock;
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 /doctors {
rewrite ^/doctors/(.*)$ /$1 break;
include proxy_params;
#proxy_pass http://unix:/run/gunicorn.sock;
proxy_pass http://localhost:3001;
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 /users {
rewrite ^/users/(.*)$ /$1 break;
include proxy_params;
#proxy_pass http://unix:/run/gunicorn.sock;
proxy_pass http://localhost:3002;
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;
}
I'm not a frontend developer or senior devops, I have to do this and I don't know how!
the three apps are named "users-front", "authors-front" and "landing". all of them send static file requests to /_next
.
I tried this and it didn't work
location /_next {
try_files $uri
/path/to/app1/.next$uri
/path/to/app2/.next$uri
/path/to/app3/.next$uri
=404; # Return 404 if not found in any location
}
本文标签: nginxserving multipe static file directory with multiple nextjs appsStack Overflow
版权声明:本文标题:nginx - serving multipe static file directory with multiple next.js apps - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1744005616a2517230.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论