V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  fibroblast  ›  全部回复第 1 页 / 共 1 页
回复总数  16
@justtokankan 这个药的名字叫<转移因子>,这个药很难喝,但是他的药效不是那么快,可以根除 我也是久病成医
哈哈不错不错
转移因子,口服液试试吧
@julyclyde 文件要给 FastCGI 好的
@wheat0r ok 了解了
@wheat0r 那个我拉住你问下 因为我是刚刚接触 php 我想问下就是 如果把 php 也扔进 docker 那么 写代码是不是会很麻烦啊
@yulgang 好的感谢
@yulgang 不是 fpm 在宿主机 nginx 在 docker
@ysc3839 好的好的 我为我愚蠢的行为搞到抱歉
@julyclyde 我理解您的意思 目前我把 nginx 改为了
···
location ~ \.php$ {
root /usr/share/nginx/html; #页面文件根目录
fastcgi_pass host.docker.internal:9000; #php-fpm 的通信端口,由于已经将容器 9000 端口映射到了主机的 9000 端口,所以这里填“主机 ip:9000”也是可以的。
fastcgi_index index.php; #默认主页文件设置
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
include fastcgi_params;
}
···

nginx error
```
FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.65.1, server: localhost, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://192.168.65.254:9000", host: "127.0.0.1:8088"
```
@julyclyde 好的我想我应该明白了
@wheat0r 🤔️ 知道了
@julyclyde 好吧 不能直接访问 9000 这个我确实没想到
@julyclyde ngixn 内部监听 80 端口 外部 8088 映射 内部 80 端口
@moell 按照您的意思
改为了
···
location ~ \.php$ {
root 172.17.0.2; #页面文件根目录
fastcgi_pass 127.0.0.1:9000; #php-fpm 的通信端口,由于已经将容器 9000 端口映射到了主机的 9000 端口,所以这里填“主机 ip:9000”也是可以的。
fastcgi_index index.php; #默认主页文件设置
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
include fastcgi_params;
}
···
好像没有作用啊
可是本地访问 9000 端口也不能访问啊,我主要还是想解决这个问题
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5638 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 18ms · UTC 06:12 · PVG 14:12 · LAX 23:12 · JFK 02:12
Developed with CodeLauncher
♥ Do have faith in what you're doing.