问题:http默认端口是80,而nuxt项目默认端口是3000
然后利用nginx代理转发到nuxt
server {
listen 80;
listen [::]:80;
server_name localhost;
location / {
# 第一种
proxy_pass http://localhost:3000;
# 第二种,利用外网网1ip访问 但是此种会绕到服务商,会收流量费
proxy_pass http://xx.xx.xx.xx:3000;
root html;
index index.html index.htm;
}
}
参考链接:https://blog.csdn.net/weixin_40918145/article/details/130614276
前面试了好多次都不行,重点在这句 listen [::]:80; 加上后才好使