diff --git a/web-nginx-php73/Dockerfile b/web-nginx-php73/Dockerfile index e4e9961..ed1f93d 100644 --- a/web-nginx-php73/Dockerfile +++ b/web-nginx-php73/Dockerfile @@ -1,14 +1,25 @@ -FROM ctftraining/base_image_nginx_php_73 -# FROM tutum/lamp +FROM php:7.3-fpm-alpine -RUN rm -r /var/www/html/index.php +# 制作者信息 +LABEL auther_template="CTF-Archives" -COPY ./src/ /var/www/html +COPY src /var/www/html -RUN chown -R www-data:www-data /var/www/html +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories &&\ + apk add --update --no-cache nginx bash COPY ./service/docker-entrypoint.sh /docker-entrypoint.sh - RUN chmod +x /docker-entrypoint.sh -ENTRYPOINT ["/bin/sh","/docker-entrypoint.sh"] \ No newline at end of file +COPY ./config/nginx.conf /etc/nginx/nginx.conf + +RUN chown -R www-data:www-data /var/www/html + +WORKDIR /var/www/html + +# [可选]指定对外暴露端口,对于GZCTF等平台,强制EXPOSE可能会造成非预期端口泄露,请酌情启用 +# EXPOSE 80 + +VOLUME ["/var/log/nginx"] + +ENTRYPOINT [ "/docker-entrypoint.sh" ] \ No newline at end of file diff --git a/web-nginx-php73/README.md b/web-nginx-php73/README.md new file mode 100644 index 0000000..7699c9e --- /dev/null +++ b/web-nginx-php73/README.md @@ -0,0 +1,3 @@ +# web-nginx-php73 + +部分容器逻辑参考自:[CTFTraining / base_image_nginx_php_73](https://github.com/CTFTraining/base_image_nginx_php_73),在此感谢[陌竹 - mozhu1024](https://github.com/mozhu1024)师傅做出的贡献 \ No newline at end of file diff --git a/web-nginx-php73/config/nginx.conf b/web-nginx-php73/config/nginx.conf new file mode 100644 index 0000000..553b298 --- /dev/null +++ b/web-nginx-php73/config/nginx.conf @@ -0,0 +1,34 @@ +# daemon off; + +worker_processes auto; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + + server { + listen 80; + server_name localhost; + root /var/www/html; + index index.php index.html index.htm; + + location / { + try_files $uri $uri/ /index.php?$args; + } + + location ~ \.php$ { + try_files $uri =404; + fastcgi_pass 127.0.0.1:9000; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + } + + } +} \ No newline at end of file diff --git a/web-nginx-php73/docker/docker-compose.yaml b/web-nginx-php73/docker/docker-compose.yaml index 79e74ea..1833512 100644 --- a/web-nginx-php73/docker/docker-compose.yaml +++ b/web-nginx-php73/docker/docker-compose.yaml @@ -4,8 +4,8 @@ services: build: ../ environment: # 仅为测试用flag - FLAG: "flag{a63b4d37-7681-4850-b6a7-0d7109febb19}" + GZCTF_FLAG: "flag{a63b4d37-7681-4850-b6a7-0d7109febb19}" ports: # 设置了暴露端口 - - 8080:8080 + - 8080:80 restart: unless-stopped