0

感谢您的关注。

我有一个运行 pm2 和 nginx 的液滴。

我让我的反应项目在主域上运行,作为测试一切正常,但想将它们移动到 /projectname 这里。

我正在尝试在不同的端口上托管一些节点项目,并尝试使用例如www.domain.com/project1www.domain.com/project两个来访问它们。

我使用 /tweetyapi 可以正常运行快速服务器 API。

下面,在 nginx 文件中,我尝试将 /domain 路由到主页作为测试,但它不起作用并说找不到它。我隐藏了我的域名和它的 IP。

多年来一直在挠头。任何人都可以阐明我如何实现我的成果(使用 /project 托管项目),或者指出我写过它的人的方向。

非常感谢

罗素

--

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        server_name XXXXXXX IP;

         location /{
        # reverse proxy for next server
        proxy_pass http://localhost:3000; # your nextJs service and port
        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;

   }

         location /dashboard {
        # reverse proxy for next server
        proxy_pass http://localhost:3000; # your nextJs service and port
        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;

   }

        location /tweetyapi {
                # reverse proxy for next server
        proxy_pass http://localhost:3333;
        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;

        }
          
4

0 回答 0