【问题标题】:Deploy nuxt application on a nginx VPS server running ubuntu在运行 ubuntu 的 nginx VPS 服务器上部署 nuxt 应用程序
【发布时间】:2020-12-19 11:12:29
【问题描述】:

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

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

我需要在服务器上设置一个反向代理来将所有请求从https://exampledomain.com/articles/重定向到localhost:3000

我已经尝试了两次,但都失败了......当我浏览 https://exampledomain.com:3000 时,应用程序正在永远加载......当我转到 https://exampledomain.com/articles 时,它显示“页面无法正常工作”或“内部服务器错误” "

请帮忙

【问题讨论】:

标签: node.js api nginx nuxt.js nginx-reverse-proxy


【解决方案1】:

这可能是由于配置不正确造成的。

试试 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;
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-07
    • 2018-10-25
    • 1970-01-01
    • 1970-01-01
    • 2018-02-17
    • 2019-09-04
    相关资源
    最近更新 更多