zoukankan      html  css  js  c++  java
  • docker 安装PHP+nginx

    下载镜像:

    docker pull nginx
    docker pull php:7.4-fpm
    

     启动nginx镜像:

    docker run  --network host  --name mynginx   
    -v /mnt/hgfs/www:/www 
    -v /mnt/hgfs/www/vm_nginx/conf.d:/etc/nginx/conf.d 
    --privileged=true 
    -d nginx
    

     参考:docker四种网络模式,容器localhost访问宿主机端口   https://blog.csdn.net/ma726518972/article/details/108146218

    编辑default.conf:

    server {
            listen       7002;
            server_name  127.0.0.1;
            location / {
                root   /www/hlyun_v3/hlyun_gateway/src/public;
                index  index.html index.htm index.php;
                try_files $uri $uri/ /index.php?$query_string;
            }
            error_page   500 502 503 504  /50x.html;
            location ~ .php$ {
                root           /www/hlyun_v3/hlyun_gateway/src/public;
                fastcgi_pass 127.0.0.1:9000;
               fastcgi_index index.php;
               fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
               fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
               fastcgi_param PATH_INFO $fastcgi_path_info;
               fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
               include  fastcgi_params;
            }
    
        }
    

      启动PHP镜像

    docker run --network host  --name myphp 
    -v /mnt/hgfs/www:/www 
    --privileged=true 
    -d php:7.4-fpm
    

      安装PHP扩展

    docker exec -it myphp /bin/bash
    
    docker-php-ext-install pdo pdo_mysql

     修改PHP-FPM

    cp /usr/local/etc/php-fpm.d/www.conf /www
    

      

  • 相关阅读:
    keepalived+httpd 高可用
    网卡绑定配置文件
    elk安装
    mysql数据库
    sed
    kvm
    日常巡检
    haproxy
    (6)PY_(study)
    (5)PY_(study)
  • 原文地址:https://www.cnblogs.com/blog-dyn/p/14517813.html
Copyright © 2011-2022 走看看