缺觉ヽ(๑Θ。Θ๑)ノ

导航

Centos下用docker(最新版)部署PHP遇到的坑

1. 创建完PHP容器后,进入PHP容器内要是在/etc目录下找不到php.ini的话,路径其实是在/usr/local/php底下。

2.nginx的defaul.conf里面的配置

 1 server {
 2     listen       80;
 3     listen  [::]:80;
 4     server_name  localhost;
 5 
 6     #access_log  /var/log/nginx/host.access.log  main;
 7 
 8     location / {
 9         root   /usr/share/nginx/html;
10         # 这块还是一样,加一个index.php
11         index  index.php index.html index.htm;
12     }
13 
14     #error_page  404              /404.html;
15 
16     # redirect server error pages to the static page /50x.html
17     #
18     error_page   500 502 503 504  /50x.html;
19     location = /50x.html {
20         root   /usr/share/nginx/html;
21     }
22 
23     # proxy the PHP scripts to Apache listening on 127.0.0.1:80
24     #
25     #location ~ \.php$ {
26     #    proxy_pass   http://127.0.0.1;
27     #}
28 
29     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
30     # 这还是把所有的#都去掉
31     location ~ \.php$ {
32         root           /var/www/html/; # 这块跟以前不一样了,要放PHP容器的项目路径
33         fastcgi_pass   172.26.0.3:9000; # 这块改成PHP容器的IP地址
34         fastcgi_index  index.php;
35         fastcgi_param  SCRIPT_FILENAME  /var/www/html/$fastcgi_script_name; # 这块也是,要放PHP容器的项目路径
36         include        fastcgi_params;
37     }
38 
39     # deny access to .htaccess files, if Apache's document root
40     # concurs with nginx's one
41     #
42     #location ~ /\.ht {
43     #    deny  all;
44     #}
45 }

 

posted on 2021-07-28 20:07  缺觉ヽ(๑Θ。Θ๑)ノ  阅读(192)  评论(0)    收藏  举报