宝塔上如何部署两个webman应用,同时运行

adminadmin

第一个项目配置

upstream webman {
    server 127.0.0.1:8787;
}

server {
  server_name data.x.com
  listen 80;
  root /your/webman/public;

  location / {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $host;
      if (!-f $request_filename){
          proxy_pass http://webman;
      }
  }
}

config/server.php


return [
    'listen' => 'http://0.0.0.0:8787',
    'transport' => 'tcp',
    'context' => [],
    'name' => 'webman',
    'count' => cpu_count() * 2,
    'user' => '',
    'group' => '',
    'reusePort' => false,
    'event_loop' => '',
    'stop_timeout' => 2,
    'pid_file' => runtime_path() . '/webman.pid',
    'status_file' => runtime_path() . '/webman.status',
    'stdout_file' => runtime_path() . '/logs/stdout.log',
    'log_file' => runtime_path() . '/logs/workerman.log',
    'max_package_size' => 10 * 1024 * 1024
];

第二个项目配置

upstream webman2 {
    server 127.0.0.1:8989;
}

server {
  server_name fun.x.com;
  listen 80;
  root /your/webman/public;

  location / {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $host;
      if (!-f $request_filename){
          proxy_pass http://webman2;
      }
  }
}

config/server.php


return [
    'listen' => 'http://0.0.0.0:8989',
    'transport' => 'tcp',
    'context' => [],
    'name' => 'webman',
    'count' => cpu_count() * 2,
    'user' => '',
    'group' => '',
    'reusePort' => false,
    'event_loop' => '',
    'stop_timeout' => 2,
    'pid_file' => runtime_path() . '/webman.pid',
    'status_file' => runtime_path() . '/webman.status',
    'stdout_file' => runtime_path() . '/logs/stdout.log',
    'log_file' => runtime_path() . '/logs/workerman.log',
    'max_package_size' => 10 * 1024 * 1024
];

supervisor都能开启成功
截图

问题:
第一个项目始终404

2735 2 3
2个回答

tj224589

设置一下Nginx反向代理
宝塔放开 安全 端口

  • 暂无评论
cqqjj1029

多个webman服务只要端口不同就行了,你是一个是8787,一个是8989。
宝塔上创建站点,绑域名用80端口,比如web1.domain.com和web2.domain.com
在web1.domain.com上做反向代理,全部代理到http://127.0.0.1:8787
在web2.domain.com上做反向代理,全部代理到http://127.0.0.1:8989
分别访问web1.domain.com和web2.domain.com,就是你想要的结果

  • 暂无评论
年代过于久远,无法发表回答
×
🔝