【问题标题】:How to setup subdomain on the nuxt js with pm2?如何使用 pm2 在 nuxt js 上设置子域?
【发布时间】:2019-08-22 06:56:08
【问题描述】:

使用 nuxt js 在服务器上设置子域时遇到问题。

我已经设置 /etc/hosts 并把 127.0.0.1 subdomain.localhost 然后重新启动 nginx 服务器并重新启动 pm2。并且主域没有使用 localhost:3000,所以端口可用。但我还是报错了。

错误说:服务器错误 应用程序发生错误,无法提供您的页面。如果您是应用程序所有者,请查看您的日志以了解详细信息。

我该如何解决这个问题?有人可以帮忙吗?

【问题讨论】:

    标签: server vuejs2 vue-router nuxt.js


    【解决方案1】:

    pm2 与域或子域无关。
    据我了解,您想将您的 nuxt 应用代理到子域。

    您必须使用 pm2 启动您的 nuxt 应用程序:
    pm2 start 'nuxt start'

    并将 localhost:3000 代理到您的域或子域,如下所示:

    server {
        listen 80;
        server_name subdomain.localhost;
    
        location / {
            proxy_set_header   Host $http_host;
            proxy_pass         http://localhost:3000;
        }
    }
    

    【讨论】:

      【解决方案2】:

      我已安装 Plesk 并使用 Plesk 我已设置子域并将 nuxt 应用程序放在那里,似乎可以工作。有很多方法 Plesk 是一种方法。要启动应用程序,我使用了https://nuxtjs.org/faq/deployment-pm2/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-03-14
        • 2022-10-18
        • 2021-10-12
        • 2019-01-23
        • 1970-01-01
        • 2011-05-03
        • 2013-08-22
        • 1970-01-01
        相关资源
        最近更新 更多