关于webman和 php-fpm 项目共存问题

hengge

服务器使用宝塔,有多个项目共存的话。如何使用webman监听80或者443端口呢?
也就是说,一个服务器可以运行多个webman项目,或者 webman和php-frm多个项目共存该如何配置呢?
可以提供下具体思路嘛?

1694 2 2
2个回答

nitron

子域名,或者根据不同路径转发到不同项目

  • 暂无评论
xiuwang

用nginx转发下就行了。比如下面是example.com的请求转发到webman 8787端口。

upstream webman {
    server 127.0.0.1:8787;
}

server {
  server_name example.com;
  listen 80;
  # webman的public目录,这样静态文件都走nginx
  root /www/wwwroot/webman/public;

  index index.php index.html ;
  location / {
      proxy_set_header X-Real-IP $remote_addr;
      if (!-f $request_filename){
          proxy_pass http://webman;
      }
  }
}

比如你还有个项目域名是example2.com,webman用的8686端口,那再加一个配置。

upstream webman2 {
    server 127.0.0.1:8686;
}

server {
  server_name example2.com;
  listen 80;
  root /www/wwwroot/webman2/public;

  index index.php index.html ;
  location / {
      proxy_set_header X-Real-IP $remote_addr;
      if (!-f $request_filename){
          proxy_pass http://webman2;
      }
  }
}
  • 暂无评论
年代过于久远,无法发表回答
🔝