Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 在运行ubuntu的nginx VPS服务器上部署nuxt应用程序_Node.js_Api_Nginx_Nuxt.js_Nginx Reverse Proxy - Fatal编程技术网

Node.js 在运行ubuntu的nginx VPS服务器上部署nuxt应用程序

Node.js 在运行ubuntu的nginx VPS服务器上部署nuxt应用程序,node.js,api,nginx,nuxt.js,nginx-reverse-proxy,Node.js,Api,Nginx,Nuxt.js,Nginx Reverse Proxy,我正在尝试将nuxt博客部署到运行nginx的虚拟专用服务器。 当我浏览到时,应该可以访问该博客 我已经成功地在服务器上运行了npm run dev。。。应用程序正在服务器上的localhost:3000上运行 我需要在服务器上设置一个反向代理,将所有请求从重定向到localhost:3000 我已经试过两次了,但都失败了。。。。当我浏览时,应用程序将永远加载。。。。当我转到它时,它会显示“页面不工作”或“内部服务器错误” 请协助由于配置不正确,可能会发生这种情况 试一试 sudo nano/e

我正在尝试将nuxt博客部署到运行nginx的虚拟专用服务器。 当我浏览到时,应该可以访问该博客

我已经成功地在服务器上运行了npm run dev。。。应用程序正在服务器上的localhost:3000上运行

我需要在服务器上设置一个反向代理,将所有请求从重定向到localhost:3000

我已经试过两次了,但都失败了。。。。当我浏览时,应用程序将永远加载。。。。当我转到它时,它会显示“页面不工作”或“内部服务器错误”


请协助

由于配置不正确,可能会发生这种情况

试一试
sudo nano/etc/nginx/sites available/your domain.com

请记住将your domain.com更改为您想要的域名

server {
    listen 80;
    listen [::]:80;
    index index.html;
    server_name your-domain.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;
    }
}

我写了一篇关于它的博客: