Sign inSign up

dlz4/php

By dlz4

•Updated almost 4 years ago

Image
0

134

dlz4/php repository overview

#default

server {
  listen 80;
 
  root /var/www/html;
  index index.html index.htm index.Nginx-debian.html;
 
  location / {
    try_files $uri $uri/ =404;
  }
  location ~ \.php$ {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
  }
}

#run.sh

#!/bin/bash
 
# 后台启动
/usr/local/sbin/php-fpm -D
 
# 关闭后台启动,hold住进程
Nginx -g 'daemon off;'

⁠Dockerfile

FROM php:7.4-fpm
# author
MAINTAINER dk <[email protected]>
ADD default /
ADD run.sh /
RUN apt-get update && \
    apt-get install -y nginx net-tools && \
    apt-get clean all && \
    mv /default /etc/nginx/conf.d/default.conf && \
    chmod 755 /run.sh

EXPOSE 80
EXPOSE 9000
ENTRYPOINT ["/run.sh"]

构建镜像

 $ docker build -t dlz4/php:7.4_ng .

⁠运行命令:

⁠测试

docker run -it dlz4/php:7.4_ng bash

⁠运行

docker run -d --name=php7 -p 20080:80 -v /home/www:/var/www/html dlz4/php:7.4_ng

#自定义nginx config
docker run -d --name=php7 -p 20080:81 -v /home/www:/var/www/html -v /home/nginx/conf.d:/etc/nginx/conf.d/ dlz4/php:7.4_ng

Tag summary

Content type

Image

Digest

sha256:f278a9657…

Size

177 MB

Last updated

almost 4 years ago

docker pull dlz4/php:7.4_ng