next.js应用程序nginx未加载css和js。指定端口(3000)时运行良好
我已经在运行ubuntu和nginx的AWS ec2实例上部署了一个nextjs应用程序 使用pm2运行nextjs nginx conf中的代理传递条目如下next.js应用程序nginx未加载css和js。指定端口(3000)时运行良好,nginx,amazon-ec2,next.js,Nginx,Amazon Ec2,Next.js,我已经在运行ubuntu和nginx的AWS ec2实例上部署了一个nextjs应用程序 使用pm2运行nextjs nginx conf中的代理传递条目如下 location / { # reverse proxy for next server proxy_pass http://127.0.0.1:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgr
location / {
# reverse proxy for next server
proxy_pass http://127.0.0.1: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;
include /etc/nginx/mime.types;
# we need to remove this 404 handling
# because next's _next folder and own handling
# try_files $uri $uri/ =404;
}
我的问题是,当我在ip中指定端口时,我的站点会正确地加载所有css和javascript
但是当没有指定端口时,比如我的css和javascript没有加载,我只能看到文本
怎么了?我们将非常感谢您的帮助。谢谢