dnmp下如何运行webman应用

问题描述

目前本地运行环境为dnmp,按照之前运行web应用的方式就是在 dnmp\services\nginx\conf.d中新增xx.config文件。

按照文档中 nginx代理 的配置:

upstream webman {
    server 127.0.0.1:8787;
}
server {
    listen 80;
    server_name webman.test ;

    root /www/webman/public;

    location / {
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header Host $host;
       if (!-f $request_filename){
          rewrite ^/(.*)$ /pc/$1 break;
          proxy_pass http://127.0.0.1:8787;
       }
    }
}

重启 nginx 后提示报错502,查看 nginx 日志:

2023/06/01 19:47:35 [error] 20#20: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.1, server: webman.test, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8787/", host: "webman.test"

尝试去 php容器 下启动 webman 项目再访问,提示 403,查看 nginx 日志:

2023/06/01 20:21:48 [error] 20#20: *2 directory index of "/www/webman/public/" is forbidden, client: 172.18.0.1, server: webman.test, request: "GET / HTTP/1.1", host: "webman.test"

想达到的效果

搜索了一圈要么就是单机启动的方式:

php start.php start

要么就是使用 docker容器 运行的方式,想请问如何在 dnmp 下运行 webman 项目,或者说 文档里给出的 nginx 配置需要做何改变?

546 2 0
2个回答

Tinywan
sunwenzheng

我也是用的dnmp ,你可以参考下
https://www.workerman.net/a/1492

🔝