diff --git a/.env.example b/.env.example deleted file mode 100644 index 4d5ae14d..00000000 --- a/.env.example +++ /dev/null @@ -1,7 +0,0 @@ -IMAGE_VERSION=8.0.151 -NGINX_VERSION=1.21.5 - -GH_MIRROR_URL=https://ghproxy.com/ - -D_PUSH=false -D_PLATFORM="linux/amd64" \ No newline at end of file diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml deleted file mode 100644 index 3dcc0daa..00000000 --- a/.github/workflows/build-push.yml +++ /dev/null @@ -1,124 +0,0 @@ -name: build-push - -on: - workflow_dispatch: - inputs: - platforms: - description: "buildx platforms" - default: "linux/amd64,linux/arm64" - required: true - type: string - nginx: - description: "nginx version" - default: "1.28.0" - required: true - type: string - php84: - description: "php8.4 image. e.g: 8.4.010" - default: "" - type: string - php83: - description: "php8.3 image. e.g: 8.3.000" - default: "" - type: string - php82: - description: "php8.2 image. e.g: 8.2.010" - default: "" - type: string - php81: - description: "php8.1 image. e.g: 8.1.100" - default: "" - type: string - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - nginx: ["${{ inputs.nginx }}"] - php: ["8.4", "8.3", "8.2", "8.1"] - include: - - php: "8.4" - tag: ${{ inputs.php84 }} - - php: "8.3" - tag: ${{ inputs.php83 }} - - php: "8.2" - tag: ${{ inputs.php82 }} - - php: "8.1" - tag: ${{ inputs.php81 }} - fail-fast: true - - steps: - - id: update - name: Update image - run: | - echo "nginx: ${{ matrix.nginx }}" - echo "tag: ${{ matrix.tag }}" - if [[ -z "${{ matrix.nginx }}" ]] || [[ -z "${{ matrix.tag }}" ]]; then - echo "no, no update" - echo "update=no" >> $GITHUB_OUTPUT - else - echo "yes, update" - echo "update=yes" >> $GITHUB_OUTPUT - fi - - - name: Generate tags - id: meta - if: steps.update.outputs.update == 'yes' - env: - IMAGES: "${{ secrets.DOCKERHUB_USERNAME }}/nginx-php ghcr.io/${{ github.actor }}/nginx-php" - run: | - IMAGE_TAGS='' - IFS=' ' read -ra IMAGE <<< "$IMAGES" - for element in "${IMAGE[@]}"; do - LAT_VER='' - if [[ "${{ matrix.php }}" == "8.4" ]]; then - LAT_VER="${element}:latest," - fi - PRE_VER="${element}:${{ matrix.php }}," - FUL_VER="${element}:${{ matrix.tag }}," - IMAGE_TAG="${LAT_VER}${PRE_VER}${FUL_VER}" - IMAGE_TAGS="${IMAGE_TAGS}${IMAGE_TAG}" - done - echo "IMAGE_TAGS=$IMAGE_TAGS" >> "$GITHUB_OUTPUT" - - - name: Set build args - if: steps.meta.outputs.IMAGE_TAGS != '' - run: | - PHP_VER=$(echo "${{ matrix.tag }}" | awk -F'.' '{ printf "%d.%d.%d", $1, $2, int($3/10) }') - echo "NGINX_VERSION=${{ matrix.nginx }}" >> $GITHUB_ENV - echo "PHP_VERSION=$PHP_VER" >> $GITHUB_ENV - - - name: Check out the repo - uses: actions/checkout@v4 - if: steps.meta.outputs.IMAGE_TAGS != '' - - name: Login into registry docker - uses: docker/login-action@v3 - if: steps.meta.outputs.IMAGE_TAGS != '' - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Login into registry ghcr - uses: docker/login-action@v3 - if: steps.meta.outputs.IMAGE_TAGS != '' - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ github.token }} - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - if: steps.meta.outputs.IMAGE_TAGS != '' - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - if: steps.meta.outputs.IMAGE_TAGS != '' - - name: Build and push - uses: docker/build-push-action@v6 - if: steps.meta.outputs.IMAGE_TAGS != '' - with: - platforms: ${{ inputs.platforms }} - file: Dockerfile - build-args: | - NGINX_VERSION=${{ env.NGINX_VERSION }} - PHP_VERSION=${{ env.PHP_VERSION }} - push: true - tags: "${{ steps.meta.outputs.IMAGE_TAGS }}" diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml deleted file mode 100644 index 8ac7553f..00000000 --- a/.github/workflows/jekyll-gh-pages.yml +++ /dev/null @@ -1,51 +0,0 @@ -# Sample workflow for building and deploying a Jekyll site to GitHub Pages -name: GitHub Pages - -on: - # Runs on pushes targeting the default branch - push: - branches: ["main"] - paths: - - .github/workflows/jekyll-gh-pages.yml - - docs/** - -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false - -jobs: - # Build job - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup Pages - uses: actions/configure-pages@v4 - - name: Build with Jekyll - uses: actions/jekyll-build-pages@v1 - with: - source: ./docs - destination: ./_site - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - - # Deployment job - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: build - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 7ab350e1..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: test-ci - -on: - workflow_dispatch: - inputs: - platforms: - description: "buildx platforms" - default: "linux/amd64,linux/arm64" - required: true - type: string - nginx: - description: "nginx version" - default: "1.26.2" - required: true - type: string - php84: - description: "e.g: 8.4.010" - default: "" - type: string - php83: - description: "e.g: 8.3.000" - default: "" - type: string - php82: - description: "e.g: 8.2.010" - default: "" - type: string - php81: - description: "e.g: 8.1.100" - default: "" - type: string - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - nginx: ["${{ inputs.nginx }}"] - php: ["8.4", "8.3", "8.2", "8.1"] - include: - - php: "8.4" - tag: ${{ inputs.php84 }} - - php: "8.3" - tag: ${{ inputs.php83 }} - - php: "8.2" - tag: ${{ inputs.php82 }} - - php: "8.1" - tag: ${{ inputs.php81 }} - fail-fast: true - - steps: - - id: update - name: Update image - run: | - echo "nginx: ${{ matrix.nginx }}" - echo "tag: ${{ matrix.tag }}" - if [[ -z "${{ matrix.nginx }}" ]] || [[ -z "${{ matrix.tag }}" ]]; then - echo "no, no update" - echo "update=no" >> $GITHUB_OUTPUT - else - echo "yes, update" - echo "update=yes" >> $GITHUB_OUTPUT - fi - - name: Matrix => (${{ matrix.php }} - ${{ matrix.tag }}) - if: steps.update.outputs.update == 'yes' - run: | - echo "update: ${{steps.update.outputs.update}}" - echo ${{ matrix.nginx }} - echo ${{ matrix.php }} - echo ${{ matrix.tag }} - - name: Generate tags - id: meta - if: steps.update.outputs.update == 'yes' - env: - IMAGES: "${{ secrets.DOCKERHUB_USERNAME }}/nginx-php ghcr.io/${{ github.actor }}/nginx-php" - run: | - IMAGE_TAGS='' - IFS=' ' read -ra IMAGE <<< "$IMAGES" - for element in "${IMAGE[@]}"; do - LAT_VER='' - if [[ "${{ matrix.php }}" == "8.4" ]]; then - LAT_VER="${element}:latest," - fi - PRE_VER="${element}:${{ matrix.php }}," - FUL_VER="${element}:${{ matrix.tag }}," - IMAGE_TAG="${LAT_VER}${PRE_VER}${FUL_VER}" - IMAGE_TAGS="${IMAGE_TAGS}${IMAGE_TAG}" - done - echo "IMAGE_TAGS=$IMAGE_TAGS" >> "$GITHUB_OUTPUT" - - name: Show docker tags - if: steps.meta.outputs.IMAGE_TAGS != '' - run: | - echo ${{ steps.meta.outputs.IMAGE_TAGS }} diff --git a/.gitignore b/.gitignore index d47750b2..d58b0de0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,3 @@ .*~ -.vscode/ .swp .DS_Store - -*.log -files/ -extensions/extension.sh -.env \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 97088b0c..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,25 +0,0 @@ -stages: - - build - -build: - stage: build - image: docker:latest - services: - - name: docker:dind - artifacts: - expire_in: 1 d - variables: - D_USER: jetsung - rules: - - changes: - - Dockerfile - - build.sh - when: manual - allow_failure: false - before_script: | - echo "$DOCKERHUB_TOKEN" | docker login "${DOCKER_REGISTRY}" -u "$DOCKERHUB_USERNAME" --password-stdin - apk --update add git curl bash - script: - - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - - docker buildx create --use --name mybuilder - - bash build.sh diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 8b773b8a..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,33 +0,0 @@ -# CHNAGELOG - -- Since [46fa6a0](https://github.com/jetsung/docker-nginx-php/tree/46fa6a0f2621a4369e3f369ce165383a81115b61) - ---- -Associated tags: `8.2.270, 8.3.150, 8.4.010` - -Base: `ubuntu:24.04` - ---- - -## 2022.01.22 - -Associated tags: `8.1.021, 8.0.151` - -Include extensions: -`bcmath,Core,ctype,curl,date,dom,exif,fileinfo,filter,ftp,gd,gettext,hash,iconv,intl,json,libxml,mbstring,mysqli,mysqlnd,openssl,pcntl,pcre,PDO,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,Phar,posix,redis,Reflection,session,shmop,SimpleXML,soap,sockets,sodium,SPL,sqlite3,standard,sysvsem,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib` - -1. The base image replaces almalinux with `ubuntu:20.04`. -2. Add `supervisor` to the image. -3. Remove extensions: `imagick,raphf,pq` -4. Add extensions: `pdo_pgsql,pgsql` - ---- - -## 2022.01.10 - -Associated tags: `8.1.013, 8.0.143, 7.4.273, 7.3, 7.2` - -Include extensions: -`bcmath,Core,ctype,curl,date,dom,exif,filter,ftp,gd,gettext,hash,iconv,intl,json,libxml,mbstring,mysqli,mysqlnd,openssl,pcntl,pcre,PDO,pdo_mysql,pdo_sqlite,Phar,posix,redis,Reflection,session,shmop,SimpleXML,soap,sockets,sodium,SPL,sqlite3,standard,sysvsem,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib` - -1. Add extensions: `fileinfo,pq,raphf,imagick,redis` diff --git a/Dockerfile b/Dockerfile index 36d41060..6d41be6e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,162 +1,157 @@ -FROM ubuntu:24.04 -LABEL maintainer="Jetsung Chan" -ARG NGINX_VERSION=1.26.2 -ARG PHP_VERSION=8.4.1 -ENV NGX_WWW_ROOT /data/wwwroot -ENV NGX_LOG_ROOT /data/wwwlogs -ENV TMP /tmp/nginx-php/ -ENV DEBIAN_FRONTEND noninteractive -RUN mkdir -p /data/{wwwroot,wwwlogs,} -RUN set -eux \ - ; \ - apt-get update -y ; \ - pkgList="apt-utils zlib1g zlib1g-dev openssl libsqlite3-dev libxml2 libxml2-dev libcurl3-gnutls libcurl4-gnutls-dev libcurl4-openssl-dev libpng-dev libjpeg8 libjpeg8-dev libargon2-1 libargon2-dev libicu-dev libxslt1-dev libzip-dev libssl-dev libfreetype-dev libfreetype6 libpq-dev libpq5 libpcre3 libpcre3-dev libsodium-dev" ; \ - for Package in ${pkgList}; do \ - apt-get install -y --no-install-recommends ${Package} ; \ - done ; \ - apt-get install -y --no-install-recommends \ - ca-certificates \ - gcc \ - g++ \ - make \ - cmake \ - autoconf \ - pkg-config \ - libtool \ - apt-utils \ - curl \ - supervisor ; \ - mkdir -p "${TMP}" && cd "${TMP}" ; \ - curl -Lk --retry 3 "https://github.com/kkos/oniguruma/releases/download/v6.9.9/onig-6.9.9.tar.gz" | gunzip | tar x \ - ; \ - # curl -Lk --retry 3 "https://github.com/jedisct1/libsodium/releases/download/1.0.18-RELEASE/libsodium-1.0.18.tar.gz" | gunzip | tar x \ - # curl -Lk --retry 3 "https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz" | gunzip | tar x \ - # ; \ - curl -Lk --retry 3 https://pecl.php.net/get/redis-6.1.0.tgz | gunzip | tar x \ - ; \ - curl -Lk --retry 3 "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" | gunzip | tar x \ - ; \ - curl -Lk --retry 3 "https://php.net/distributions/php-${PHP_VERSION}.tar.gz" | gunzip | tar x \ - ; \ - cd onig-6.9.9 ; \ - ./configure --prefix=/usr ; \ - make && make install ; \ - # cd .. ; \ - # cd libsodium-1.0.18 ; \ - # ./configure --disable-dependency-tracking --enable-minimal ; \ - # make && make install ; \ - cd .. ; \ - cd "php-${PHP_VERSION}" ; \ - export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig/ ; \ - ./configure --prefix=/usr/local/php/ \ - --with-config-file-path=/usr/local/php/etc/ \ - --with-config-file-scan-dir=/usr/local/php/etc/php.d/ \ - --with-fpm-user=www \ - --with-fpm-group=www \ - --with-mysqli=mysqlnd \ - --with-pdo-mysql=mysqlnd \ - --with-pgsql \ - --with-pdo-pgsql \ - --with-zip=/usr/local \ - --with-sodium \ - --with-openssl \ - --with-iconv \ - --with-zlib \ - --with-gettext \ - --with-curl \ - --with-freetype \ - --with-jpeg \ - --with-mhash \ - --with-xsl \ - --with-password-argon2 \ - --enable-fpm \ - --enable-xml \ - --enable-shmop \ - --enable-sysvsem \ - --enable-mbregex \ - --enable-mbstring \ - --enable-ftp \ - --enable-mysqlnd \ - --enable-pcntl \ - --enable-sockets \ - --enable-soap \ - --enable-session \ - --enable-bcmath \ - --enable-exif \ - --enable-intl \ - --enable-fileinfo \ - --enable-gd \ - --enable-ipv6 \ - --disable-opcache \ - --disable-rpath \ - --disable-debug \ - --without-pear \ - # --enable-opcache \ - # --disable-fileinfo \ - ; \ - make && make install ; \ - mkdir /usr/local/php/etc/php.d/ ; \ - cp php.ini-production /usr/local/php/etc/php.ini ; \ - cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf ; \ - cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf ; \ - ln -s /usr/local/php/bin/* /bin/ ; \ - ln -s /usr/local/php/sbin/* /bin/ ; \ - cd .. ; \ - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" ; \ - # php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" ; \ - php composer-setup.php ; \ - php -r "unlink('composer-setup.php');" ; \ - mv composer.phar /usr/local/bin/composer ; \ - chmod +x /usr/local/bin/composer ; \ - EXTENSION_DIR=$(php-config --extension-dir) ; \ - cd redis-6.1.0 ; \ - phpize ; \ - ./configure --with-php-config=/usr/local/php/bin/php-config ; \ - make && make install ; \ - if [ -f "${EXTENSION_DIR}/redis.so" ]; then \ - echo 'extension=redis.so' > /usr/local/php/etc/php.d/05-redis.ini ; \ - fi ; \ - cd .. ; \ - cd "nginx-${NGINX_VERSION}" ; \ - ./configure --prefix=/usr/local/nginx \ - --user=www --group=www \ - --error-log-path="${NGX_LOG_ROOT}/nginx_error.log" \ - --http-log-path="${NGX_LOG_ROOT}/nginx_access.log" \ - --pid-path=/var/run/nginx.pid \ - --with-pcre \ - --with-http_ssl_module \ - --with-http_v2_module \ - --without-mail_pop3_module \ - --without-mail_imap_module \ - --with-http_gzip_static_module \ - ; \ - make && make install ; \ - ln -s /usr/local/nginx/sbin/* /bin/ ; \ - useradd -r -s /sbin/nologin -d "${NGX_WWW_ROOT}" -m -k no www ; \ - cd / ; \ - rm -rf "${TMP}" ; \ - apt-get remove -y gcc \ - g++ \ - autoconf \ - automake \ - libtool \ - make \ - cmake \ - ; \ - apt-get autoremove -y ; \ - apt-get autoclean -y ; \ - apt-get clean -y ; \ - rm -rf /var/lib/apt/lists/* ; \ - find /var/log -type f -delete -VOLUME ["/data/wwwroot", "/data/wwwlogs"] -WORKDIR /app -EXPOSE 80 443 9000 -COPY nginx.conf /usr/local/nginx/conf/ -COPY vhost /usr/local/nginx/conf/vhost/ -COPY www "${NGX_WWW_ROOT}" -COPY supervisord /etc/supervisor/conf.d/ -COPY entrypoint.sh /app -RUN chown -R www:www "${NGX_WWW_ROOT}" ; \ - chmod +x /app/entrypoint.sh -ENTRYPOINT ["/app/entrypoint.sh"] -CMD ["-D"] +FROM centos:7 +MAINTAINER Skiychan + +ENV NGINX_VERSION 1.11.6 +ENV PHP_VERSION 7.1.0 + +RUN set -x && \ + yum install -y gcc \ + gcc-c++ \ + autoconf \ + automake \ + libtool \ + make \ + cmake && \ + +#Install PHP library +## libmcrypt-devel DIY + rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm && \ + yum install -y zlib \ + zlib-devel \ + openssl \ + openssl-devel \ + pcre-devel \ + libxml2 \ + libxml2-devel \ + libcurl \ + libcurl-devel \ + libpng-devel \ + libjpeg-devel \ + freetype-devel \ + libmcrypt-devel \ + openssh-server \ + python-setuptools && \ + +#Add user + mkdir -p /data/{www,phpext} && \ + useradd -r -s /sbin/nologin -d /data/www -m -k no www && \ + +#Download nginx & php + mkdir -p /home/nginx-php && cd $_ && \ + curl -Lk http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz | gunzip | tar x -C /home/nginx-php && \ + curl -Lk http://php.net/distributions/php-$PHP_VERSION.tar.gz | gunzip | tar x -C /home/nginx-php && \ + +#Make install nginx + cd /home/nginx-php/nginx-$NGINX_VERSION && \ + ./configure --prefix=/usr/local/nginx \ + --user=www --group=www \ + --error-log-path=/var/log/nginx_error.log \ + --http-log-path=/var/log/nginx_access.log \ + --pid-path=/var/run/nginx.pid \ + --with-pcre \ + --with-http_ssl_module \ + --without-mail_pop3_module \ + --without-mail_imap_module \ + --with-http_gzip_static_module && \ + make && make install && \ + +#Make install php + cd /home/nginx-php/php-$PHP_VERSION && \ + ./configure --prefix=/usr/local/php \ + --with-config-file-path=/usr/local/php/etc \ + --with-config-file-scan-dir=/usr/local/php/etc/php.d \ + --with-fpm-user=www \ + --with-fpm-group=www \ + --with-mcrypt=/usr/include \ + --with-mysqli \ + --with-pdo-mysql \ + --with-openssl \ + --with-gd \ + --with-iconv \ + --with-zlib \ + --with-gettext \ + --with-curl \ + --with-png-dir \ + --with-jpeg-dir \ + --with-freetype-dir \ + --with-xmlrpc \ + --with-mhash \ + --enable-fpm \ + --enable-xml \ + --enable-shmop \ + --enable-sysvsem \ + --enable-inline-optimization \ + --enable-mbregex \ + --enable-mbstring \ + --enable-ftp \ + --enable-gd-native-ttf \ + --enable-mysqlnd \ + --enable-pcntl \ + --enable-sockets \ + --enable-zip \ + --enable-soap \ + --enable-session \ + --enable-opcache \ + --enable-bcmath \ + --enable-exif \ + --enable-fileinfo \ + --disable-rpath \ + --enable-ipv6 \ + --disable-debug \ + --without-pear && \ + make && make install && \ + + +#Install php-fpm + cd /home/nginx-php/php-$PHP_VERSION && \ + cp php.ini-production /usr/local/php/etc/php.ini && \ + cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf && \ + cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf && \ + +#Install supervisor + easy_install supervisor && \ + mkdir -p /var/{log/supervisor,run/{sshd,supervisord}} && \ + +#Clean OS + yum remove -y gcc \ + gcc-c++ \ + autoconf \ + automake \ + libtool \ + make \ + cmake && \ + yum clean all && \ + rm -rf /tmp/* /var/cache/{yum,ldconfig} /etc/my.cnf{,.d} && \ + mkdir -p --mode=0755 /var/cache/{yum,ldconfig} && \ + find /var/log -type f -delete && \ + rm -rf /home/nginx-php && \ + +#Change Mod from webdir + chown -R www:www /data/www + +#Add supervisord conf +ADD supervisord.conf /etc/ + +#Create web folder +VOLUME ["/data/www", "/usr/local/nginx/conf/ssl", "/usr/local/nginx/conf/vhost", "/usr/local/php/etc/php.d", "/data/phpext"] + +ADD index.php /data/www/ + +ADD extini/ /usr/local/php/etc/php.d/ +ADD extfile/ /data/phpext/ + +#Update nginx config +ADD nginx.conf /usr/local/nginx/conf/ + +#Start +ADD start.sh / +RUN chmod +x /start.sh + +#Set port +EXPOSE 80 443 + +#Start it +ENTRYPOINT ["/start.sh"] + +#Start web server +#CMD ["/bin/bash", "/start.sh"] diff --git a/LICENSE b/LICENSE deleted file mode 100644 index d08c529d..00000000 --- a/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright 2023 Jetsung Chan - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/README.md b/README.md index 18207edc..0191e0d9 100644 --- a/README.md +++ b/README.md @@ -1,116 +1,82 @@ -# Nginx and PHP for Docker +Nginx and PHP for Docker -English | [简体中文](./README_CN.md) +## Last Version +nginx: **1.11.6** +php: **7.1.0** -## Version - -| Name | Version | Docker tag | -| :------ | :------ | :----------: | -| **PHP** | 8.4.x | latest / 8.4 | -| **PHP** | 8.3.x | 8.3 | -| **PHP** | 8.2.x | 8.2 | -| **PHP** | 8.1.x | 8.1 | - -### EOL - -| Docker tag | PHP | NGINX | -| :---------- | :----- | :----: | -| **8.0.300** | 8.0.30 | 1.24.0 | - -## Include extensions - -```bash -bcmath,Core,ctype,curl,date,dom,exif,fileinfo,filter,ftp,gd,gettext,hash,iconv,intl,json,libxml,mbstring,mysqli,mysqlnd,openssl,pcntl,pcre,PDO,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,Phar,posix,redis,Reflection,session,shmop,SimpleXML,soap,sockets,sodium,SPL,sqlite3,standard,sysvsem,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib +## Docker Hub +**Nginx-PHP7:** [https://hub.docker.com/r/skiychan/nginx-php7](https://hub.docker.com/r/skiychan/nginx-php7) + +## Installation +Pull the image from the docker index rather than downloading the git repo. This prevents you having to build the image on every docker host. +```sh +docker pull skiychan/nginx-php7:latest ``` -> [Custom extension](./extensions) - -## Container Hub - -1. **[Docker Hub: `nginx-php`](https://hub.docker.com/r/jetsung/nginx-php)** - -```bash -docker pull jetsung/nginx-php:latest +To pull the Nightly Version: ``` - -2. **[GitHub Packages: `nginx-php`](https://github.com/jetsung/docker-nginx-php/pkgs/container/nginx-php)** - -```bash -docker pull ghcr.io/jetsung/nginx-php:latest +docker pull skiychan/nginx-php7:nightly ``` -## Manual - -- **[WebSite](http://nginx-php.zzzzy.com)** -- [Documents](./docs) -- [Extensions](./extensions) - -## Build - +## Running +To simply run the container: ```sh -git clone https://github.com/jetsung/docker-nginx-php.git - -cd nginx-php - -docker build --build-arg PHP_VERSION="8.1.1" \ - --build-arg NGINX_VERSION="1.20.0" \ - -t nginx-php:8.1 \ - -f ./Dockerfile . +docker run --name nginx -p 8080:80 -d skiychan/nginx-php7 ``` +You can then browse to http://\:8080 to view the default install files. -## Installation - -Pull the image from the docker index rather than downloading the git repo. This prevents you having to build the image on every docker host. - +## Volumes +If you want to link to your web site directory on the docker host to the container run: ```sh -docker pull jetsung/nginx-php:latest +docker run --name nginx -p 8080:80 -v /your_code_directory:/data/www -d skiychan/nginx-php7 ``` -## Running - -To simply run the container: - +## Enabling SSL ```sh -docker run --name nginx -p 8080:80 -d jetsung/nginx-php +docker run -d --name=nginx \ +-p 80:80 -p 443:443 \ +-v your_crt_key_files:/usr/local/nginx/conf/ssl \ +-e PROXY_WEB=On \ +-e PROXY_CRT=your_crt_name \ +-e PROXY_KEY=your_key_name \ +-e PROXY_DOMAIN=your_domain \ +skiychan/nginx-php7 ``` -You can then browse to `http://\:8080` to view the default install files. - -### docker-compose.yml - -```yaml -version: "3" -services: - nginx-php: - image: jetsung/nginx-php:latest - ports: - - "38080:80" +## Enabling Extensions With *.so +Add xxx.ini to folder ```/your_php_extension_ini``` and add xxx.so to folder ```/your_php_extension_file```, then run the command: +```sh +docker run --name nginx \ +-p 8080:80 -d \ +-v /your_php_extension_ini:/usr/local/php/etc/php.d \ +-v /your_php_extension_file:/data/phpext \ +skiychan/nginx-php7 ``` +in xxx.ini, "zend_extension = /data/phpext/xxx.so", the zend_extension must be use ```/data/phpext/```. -## Command line tools - -Use `docker exec {CONTAINER ID} {COMMAND}` - -```bash -# Current process -docker exec {CONTAINER ID} ps -ef -# Current PHP version -docker exec {CONTAINER ID} php --version +## Enabling Extensions With Source +Also, You can add the source to ```extension.sh```. Example: +``` +#Add extension mongodb +curl -Lk https://pecl.php.net/get/mongodb-1.1.8.tgz | gunzip | tar x -C /home/extension && \ +cd /home/extension/mongodb-1.1.8 && \ +/usr/local/php/bin/phpize && \ +./configure --with-php-config=/usr/local/php/bin/php-config && \ +make && make install +``` +Add ```mongodb.ini``` to folder ```extini```: +``` +extension=mongodb.so +``` -# supervisord -## HELP -docker exec {CONTAINER ID} supervisorctl --help -## STOP, START, STATUS (stop/start/status) -docker exec {CONTAINER ID} supervisorctl stop all -## STOP NGINX / PHP -docker exec {CONTAINER ID} supervisorctl stop nginx/php-fpm +You can see the **[wiki](https://github.com/skiy-dockerfile/nginx-php7/wiki/Question-&-Answer)** -# Container not started -## PHP version -docker run --rm -it jetsung/nginx-php:latest php --version +## [ChangeLog](changelogs.md) -## NGINX version -docker run --rm -it jetsung/nginx-php:latest nginx -v -``` +## Thanks +[Legion](https://www.dwhd.org) -## [CHANGELOG](./CHANGELOG.md) +## Author +Author: Skiychan +Email: dev@skiy.net +Link: https://www.skiy.net diff --git a/README_CN.md b/README_CN.md deleted file mode 100644 index 8aa1cac8..00000000 --- a/README_CN.md +++ /dev/null @@ -1,116 +0,0 @@ -# Nginx and PHP for Docker - -[English](./README.md) | 简体中文 - -## 版本 - -| 名称 | 版本 | Docker 标签 | -| :------ | :---- | :----------: | -| **PHP** | 8.4.x | latest / 8.4 | -| **PHP** | 8.3.x | 8.3 | -| **PHP** | 8.2.x | 8.2 | -| **PHP** | 8.1.x | 8.1 | - -### 终止 - -| Docker tag | PHP | NGINX | -| :---------- | :----- | :----: | -| **8.0.300** | 8.0.30 | 1.24.0 | - -## 包含扩展 - -```bash -bcmath,Core,ctype,curl,date,dom,exif,fileinfo,filter,ftp,gd,gettext,hash,iconv,intl,json,libxml,mbstring,mysqli,mysqlnd,openssl,pcntl,pcre,PDO,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,Phar,posix,redis,Reflection,session,shmop,SimpleXML,soap,sockets,sodium,SPL,sqlite3,standard,sysvsem,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib -``` - -> [定制扩展](./extensions) - -## Container Hub - -1. **[Docker Hub: `nginx-php`](https://hub.docker.com/r/jetsung/nginx-php)** - -```bash -docker pull jetsung/nginx-php:latest -``` - -2. **[GitHub Packages: `nginx-php`](https://github.com/jetsung/docker-nginx-php/pkgs/container/nginx-php)** - -```bash -docker pull ghcr.io/jetsung/nginx-php:latest -``` - -## 手册 - -- **[网站](http://nginx-php.zzzzy.com)** -- [文档](./docs) -- [扩展](./extensions) - -## 构建 - -```sh -git clone https://github.com/jetsung/docker-nginx-php.git - -cd nginx-php - -docker build --build-arg PHP_VERSION="8.1.1" \ - --build-arg NGINX_VERSION="1.20.0" \ - -t nginx-php:8.1 \ - -f ./Dockerfile . -``` - -## 安装使用 - -从 Docker 拉取镜像 - -```sh -docker pull jetsung/nginx-php:latest -``` - -## 启动 - -使用镜像启动基础容器 - -```sh -docker run --name nginx -p 8080:80 -d jetsung/nginx-php -``` - -你可以通过浏览器访问 `http://\:8080` 查看 `PHP` 配置信息。 - -### docker-compose.yml - -```yaml -version: "3" -services: - nginx-php: - image: jetsung/nginx-php:latest - ports: - - "38080:80" -``` - -## 命令行工具 - -使用 `docker exec {CONTAINER ID} {COMMAND}` - -```bash -# 查看当前进程 -docker exec {CONTAINER ID} ps -ef -# 查看当前 PHP 版本 -docker exec {CONTAINER ID} php --version - -# supervisord -## 帮助 -docker exec {CONTAINER ID} supervisorctl --help -## 停止、启动、状态 (stop/start/status) -docker exec {CONTAINER ID} supervisorctl stop all -## 停止 NGINX / PHP -docker exec {CONTAINER ID} supervisorctl stop nginx/php-fpm - -# 未启动容器 -## 查看 PHP 版本 -docker run --rm -it jetsung/nginx-php:latest php --version - -## 查看 NGINX 版本 -docker run --rm -it jetsung/nginx-php:latest nginx -v -``` - -## [CHANGELOG](./CHANGELOG.md) diff --git a/build.sh b/build.sh deleted file mode 100755 index 30d27e38..00000000 --- a/build.sh +++ /dev/null @@ -1,188 +0,0 @@ -#!/usr/bin/env bash - -####### Build Script ####### - -show_errmsg() { - printf "\e[1;31m%s \e[0m\n" "${1}" - exit 1 -} - -version_split() { - tag_full_ver="${1}" # "8.2.080" 或 "8.2.180" - tag_pre_ver=${tag_full_ver:0:3} - - ver1=${tag_full_ver:4:2} - ver1=${ver1#0} # 移除前导零,以确保数字被解释为十进制 - - php_ver="${tag_pre_ver}.${ver1}" - - printf " -TAG FULL: %s -TAG PRE VER: %s -PHP VERSION: %s -" "$tag_full_ver" "$tag_pre_ver" "$php_ver" -} - -# docker buildx -docker_buildx() { - printf " -TAGS: - %snginx-php:%s - %snginx-php:%s -" "$prefix" "$tag_full_ver" "$prefix" "$tag_pre_ver" - - docker login ghcr.io - - if [[ "$tag_pre_ver" = "8.2" ]]; then - # docker buildx build --platform linux/amd64,linux/arm64 \ - docker buildx build --platform "${D_PLATFORM}" \ - --output "type=image,push=${D_PUSH}" \ - --tag "${prefix}nginx-php:${tag_full_ver}" \ - --tag "${prefix}nginx-php:${tag_pre_ver}" \ - --tag "${prefix}nginx-php:latest" \ - --build-arg PHP_VERSION="${php_ver}" \ - --build-arg NGINX_VERSION="${NGINX_VERSION}" \ - --build-arg GH_MIRROR_URL="${GH_MIRROR_URL}" \ - --file ./Dockerfile \ - --progress plain \ - . - - # ghcr - GH_CR_PRE="ghcr.io/${prefix}nginx-php:tag_pre_ver" - GH_CR_LATEST="ghcr.io/${prefix}nginx-php:latest" - docker tag "${prefix}nginx-php:tag_pre_ver" "$GH_CR_PRE" - docker tag "${prefix}nginx-php:latest" "$GH_CR_LATEST" - docker push --platform "${D_PLATFORM}" "$GH_CR_PRE" - docker push --platform "${D_PLATFORM}" "$GH_CR_LATEST" - else - # docker buildx build --platform linux/amd64,linux/arm64 \ - docker buildx build --platform "${D_PLATFORM}" \ - --output "type=image,push=${D_PUSH}" \ - --tag "${prefix}nginx-php:${tag_full_ver}" \ - --tag "${prefix}nginx-php:${tag_pre_ver}" \ - --build-arg PHP_VERSION="${php_ver}" \ - --build-arg NGINX_VERSION="${NGINX_VERSION}" \ - --build-arg GH_MIRROR_URL="${GH_MIRROR_URL}" \ - --file ./Dockerfile \ - --progress plain \ - . - - # ghcr - GH_CR_PRE="ghcr.io/${prefix}nginx-php:tag_pre_ver" - docker tag "${prefix}nginx-php:tag_pre_ver" "$GH_CR_PRE" - docker push --platform "${D_PLATFORM}" "$GH_CR_PRE" - fi -} - -# 只当前构架,不使用 QEMU -docker_build() { - # 构建 - docker_tag - - # 推送 - if [[ "${D_PUSH}" = "true" ]]; then - docker_push - fi -} - -# 构建与生成 TAG -docker_tag() { - docker build --build-arg PHP_VERSION="${php_ver}" \ - --build-arg NGINX_VERSION="${NGINX_VERSION}" \ - --build-arg GH_MIRROR_URL="${GH_MIRROR_URL}" \ - -t "${prefix}"nginx-php:"${tag_full_ver}" \ - -f ./Dockerfile . || - show_errmsg "docker build failed" - - image_id=$(docker images | grep "${prefix}"nginx-php | grep "${tag_full_ver}" | awk '{print $3}') - - docker tag "${image_id}" "${prefix}"nginx-php:"${tag_pre_ver}" || show_errmsg "docker tag failed" - - if [[ "${tag_pre_ver}" = "8.3" ]]; then - docker tag "${image_id}" "${prefix}"nginx-php:latest - fi -} - -# 推送 -docker_push() { - docker push "${prefix}"nginx-php:"${tag_full_ver}" - docker push "${prefix}"nginx-php:"${tag_pre_ver}" - - if [[ "${tag_pre_ver}" = "8.3" ]]; then - docker push "${prefix}"nginx-php:latest - fi -} - -build() { - version_split "${1}" - - rm -rf ./logoutput.log - if [ -z "$BUILDX_ENABLE" ]; then - # 不使用 buildx,只编译 amd64 - echo "build" - docker_build 2>&1 | tee ./logoutput.log - else - # 使用 docker buildx - echo "buildx" - docker_buildx 2>&1 | tee ./logoutput.log - fi - - # https://github.com/dutchcoders/transfer.sh/ - #curl --upload-file ./logoutput.log https://transfer.sh/logoutput.log -} - -main() { - set -e - - if [ -z "${1}" ]; then - prefix="jetsung/" - else - prefix="${1}/" - fi - - if [ -z "${D_PUSH}" ]; then - D_PUSH="false" # 是否推送 - fi - - if [ -z "${D_PLATFORM}" ]; then - D_PLATFORM="linux/amd64,linux/arm64" # 构建环境 - fi - - # locale env - if [[ "${2}" = "env" ]] && [ -f ".env" ]; then - # shellcheck disable=SC1091 - source .env - fi - - # 架构大于 1 则使用 buildx - if echo "$D_PLATFORM" | grep -q ','; then - BUILDX_ENABLE="yes" - fi - - build_time=$(date "+%F %T") - _PUSH=$(echo "${D_PUSH}" | tr '[:lower:]' '[:upper:]') - _PLAT_FORM=$(echo "${D_PLATFORM}" | tr '[:lower:]' '[:upper:]') - printf " -****** [ BUILD START ] ****** -build time: %s -docker push: %s -build platform: %s -php version: %s -prefix: %s -gh_proxy: %s -" "$build_time" "$_PUSH" "$_PLAT_FORM" "$IMAGE_VERSION" "$prefix" "$GH_MIRROR_URL" - - string="$IMAGE_VERSION" - array=${string//,/ } - - # shellcheck disable=SC2068 - for var in ${array[@]}; do - # echo "${var}" - build "$var" - done - -} - -main "$@" || exit 1 - -# ./build.sh jetsung env diff --git a/changelogs.md b/changelogs.md new file mode 100644 index 00000000..e9299fa0 --- /dev/null +++ b/changelogs.md @@ -0,0 +1,79 @@ +**2016 / 12 / 04:** +updated php to version 7.1.0 +updated nginx to version 1.11.6 + +**2016 / 10 / 14:** +updated php to version 7.0.12 +updated nginx to version 1.11.5 + +**2016 / 08 / 21:** +updated php to version 7.0.10 + +**2016 / 08 / 03:** +added diy extension support +added mongodb support +clean the cache files, the mirror less 500M now. + +**2016 / 08 / 02:** +updated nginx to version 1.11.3 + +**2016 / 07 / 22:** +updated php to version 7.0.9 + +**2016 / 07 / 05:** +updated nginx to version 1.11.2 + +**2016 / 06 / 23:** +updated php to version 7.0.8 + +**2016 / 06 / 02:** +updated nginx to version 1.11.1 + +**2016 / 05 / 26:** +removed xdebug port +updated php to version 7.0.7 +updated nginx to version 1.11.0 + +**2016 / 05 / 06:** +fixbug php-fpm repeated start +updated xdebug port to 9001 + +**2016 / 04 / 28:** +updated php to version 7.0.6 + +**2016 / 04 / 27:** +updated nginx to version 1.10.0 +updated xdebug port to 9999 + +**2016 / 04 / 20:** +updated nginx to version 1.9.15 + +**2016 / 04 / 06:** +updated nginx to version 1.9.14 + +**2016 / 04 / 01:** +updated php to version 7.0.5 +updated nginx to version 1.9.13 +updated xdebug info + +**2016 / 03 / 04:** +updated php to version 7.0.4 + +**2016 / 02 / 29:** +updated nginx to version 1.9.12 + +**2016 / 02 / 13:** +updated nginx to version 1.9.11 + +**2016 / 02 / 04:** +updated php to version 7.0.3 + +**2016 / 01 / 29:** +add fileinfo support +add ipv6 support + +**2016 / 01 / 27:** +updated nginx to version 1.9.10 + +**2016 / 01 / 25:** +add xdebug support diff --git a/docs/.gitignore b/docs/.gitignore deleted file mode 100644 index a0f0e538..00000000 --- a/docs/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.vscode -.DS_Store diff --git a/docs/CNAME b/docs/CNAME deleted file mode 100644 index dd32e04b..00000000 --- a/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -nginx-php.zzzzy.com \ No newline at end of file diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index d03ca92b..00000000 --- a/docs/README.md +++ /dev/null @@ -1,164 +0,0 @@ -This example is based on the source code: -[https://github.com/jetsung/docker-nginx-php/tree/main/example](https://github.com/jetsung/docker-nginx-php/tree/main/example) - -English | [简体中文](./README_CN.md) - -### Include extensions - -```bash -bcmath,Core,ctype,curl,date,dom,exif,fileinfo,filter,ftp,gd,gettext,hash,iconv,intl,json,libxml,mbstring,mysqli,mysqlnd,openssl,pcntl,pcre,PDO,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,Phar,posix,redis,Reflection,session,shmop,SimpleXML,soap,sockets,sodium,SPL,sqlite3,standard,sysvsem,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib -``` - -> [Custom extension](#custom-extension) - -### Container Hub - -1. **[Docker Hub: `nginx-php`](https://hub.docker.com/r/jetsung/nginx-php)** - -```bash -docker pull jetsung/nginx-php:latest -``` - -2. **[GitHub Packages: `nginx-php`](https://github.com/jetsung/docker-nginx-php/pkgs/container/nginx-php)** - -```bash -docker pull ghcr.io/jetsung/nginx-php:latest -``` - -### Command line tools - -Use `docker exec {CONTAINER ID} {COMMAND}` - -```bash -# Current process -docker exec {CONTAINER ID} ps -ef -# Current PHP version -docker exec {CONTAINER ID} php --version - -# supervisord -## HELP -docker exec {CONTAINER ID} supervisorctl --help -## STOP, START, STATUS (stop/start/status) -docker exec {CONTAINER ID} supervisorctl stop all -## STOP NGINX / PHP -docker exec {CONTAINER ID} supervisorctl stop nginx/php-fpm - -# Container not started -## PHP version -docker run --rm -it jetsung/nginx-php:latest php --version - -## NGINX version -docker run --rm -it jetsung/nginx-php:latest nginx -v -``` - -### Default - -``` -docker run -d -p 38080:80 \ -jetsung/nginx-php -``` - -[http://docker.222029.xyz:38080](http://docker.222029.xyz:38080) - -- `docker-compose.yml` - -```yaml -version: "3" -services: - nginx-php: - image: jetsung/nginx-php:latest - ports: - - "38080:80" -``` - ---- - -### Custom website directory - -``` -docker run -d -p 38081:80 \ --v $(pwd)/wwwroot:/data/wwwroot \ -jetsung/nginx-php -``` - -[http://docker.222029.xyz:38081](http://docker.222029.xyz:38081) - -- `docker-compose.yml` - -```yaml -version: "3" -services: - nginx-php: - image: jetsung/nginx-php:latest - volumes: - - ./wwwroot:/data/wwwroot - ports: - - "38081:80" -``` - ---- - -### Bind the domain and the `SSL` certificate, make it to support `HTTPS`. - -``` -docker run -d -p 38082:80 \ --p 38083:443 \ --v $(pwd)/wwwroot:/data/wwwroot \ --v $(pwd)/wwwlogs:/data/wwwlogs \ --v $(pwd)/vhost:/usr/local/nginx/conf/vhost \ --v $(pwd)/ssl:/usr/local/nginx/conf/ssl \ -jetsung/nginx-php -``` - -[http://docker.222029.xyz:38082](http://docker.222029.xyz:38082) -[https://docker.222029.xyz:38083](https://docker.222029.xyz:38083) - -- `docker-compose.yml` - -```yaml -version: "3" -services: - nginx-php: - image: jetsung/nginx-php:latest - volumes: - - ./wwwroot:/data/wwwroot - - ./wwwlogs:/data/wwwlogs - - ./vhost:/usr/local/nginx/conf/vhost - - ./ssl:/usr/local/nginx/conf/ssl - ports: - - "38082:80" - - "38083:443" -``` - ---- - -### Custom extension - -``` -docker run -d -p 38084:80 \ --v $(pwd)/wwwroot:/data/wwwroot \ --v $(pwd)/wwwlogs:/data/wwwlogs \ --v $(pwd)/extension.sh:/app/extension.sh \ -jetsung/nginx-php -``` - -> Create a file `extension.sh` (you cannot change the file name),context as [swoole](https://github.com/jetsung/docker-nginx-php/blob/main/extensions/swoole.sh) - -[http://docker.222029.xyz:38084](http://docker.222029.xyz:38084) - -- `docker-compose.yml` - -```yaml -version: "3" -services: - nginx-php: - image: jetsung/nginx-php:latest - volumes: - - ./wwwroot:/data/wwwroot - - ./wwwlogs:/data/wwwlogs - - ./extension.sh:/app/extension.sh - ports: - - "38084:80" -``` - -### [Changelog](https://github.com/jetsung/docker-nginx-php/blob/main/CHANGELOG.md) diff --git a/docs/README_CN.md b/docs/README_CN.md deleted file mode 100644 index 0b54e5a9..00000000 --- a/docs/README_CN.md +++ /dev/null @@ -1,164 +0,0 @@ -案例基于源码: -[https://github.com/jetsung/docker-nginx-php/tree/main/example](https://github.com/jetsung/docker-nginx-php/tree/main/example) - -[English](./README.md) | 简体中文 - -### 包含扩展 - -```bash -bcmath,Core,ctype,curl,date,dom,exif,fileinfo,filter,ftp,gd,gettext,hash,iconv,intl,json,libxml,mbstring,mysqli,mysqlnd,openssl,pcntl,pcre,PDO,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,Phar,posix,redis,Reflection,session,shmop,SimpleXML,soap,sockets,sodium,SPL,sqlite3,standard,sysvsem,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib -``` - -> [定制扩展](#定制扩展) - -### Container Hub - -1. **[Docker Hub: `nginx-php`](https://hub.docker.com/r/jetsung/nginx-php)** - -```bash -docker pull jetsung/nginx-php:latest -``` - -2. **[GitHub Packages: `nginx-php`](https://github.com/jetsung/docker-nginx-php/pkgs/container/nginx-php)** - -```bash -docker pull ghcr.io/jetsung/nginx-php:latest -``` - -### 命令行工具 - -使用 `docker exec {CONTAINER ID} {COMMAND}` - -```bash -# 查看当前进程 -docker exec {CONTAINER ID} ps -ef -# 查看当前 PHP 版本 -docker exec {CONTAINER ID} php --version - -# supervisord -## 帮助 -docker exec {CONTAINER ID} supervisorctl --help -## 停止、启动、状态 (stop/start/status) -docker exec {CONTAINER ID} supervisorctl stop all -## 停止 NGINX / PHP -docker exec {CONTAINER ID} supervisorctl stop nginx/php-fpm - -# 未启动容器 -## 查看 PHP 版本 -docker run --rm -it jetsung/nginx-php:latest php --version - -## 查看 NGINX 版本 -docker run --rm -it jetsung/nginx-php:latest nginx -v -``` - -### 默认 - -``` -docker run -d -p 38080:80 \ -jetsung/nginx-php -``` - -[http://docker.222029.xyz:38080](http://docker.222029.xyz:38080) - -- `docker-compose.yml` - -```yaml -version: "3" -services: - nginx-php: - image: jetsung/nginx-php:latest - ports: - - "38080:80" -``` - ---- - -### 自定义网站目录 - -``` -docker run -d -p 38081:80 \ --v $(pwd)/wwwroot:/data/wwwroot \ -jetsung/nginx-php -``` - -[http://docker.222029.xyz:38081](http://docker.222029.xyz:38081) - -- `docker-compose.yml` - -```yaml -version: "3" -services: - nginx-php: - image: jetsung/nginx-php:latest - volumes: - - ./wwwroot:/data/wwwroot - ports: - - "38081:80" -``` - ---- - -### 绑定域名 和 使用 `SSL` 证书,让网站支持 `HTTPS` - -``` -docker run -d -p 38082:80 \ --p 38083:443 \ --v $(pwd)/wwwroot:/data/wwwroot \ --v $(pwd)/wwwlogs:/data/wwwlogs \ --v $(pwd)/vhost:/usr/local/nginx/conf/vhost \ --v $(pwd)/ssl:/usr/local/nginx/conf/ssl \ -jetsung/nginx-php -``` - -[http://docker.222029.xyz:38082](http://docker.222029.xyz:38082) -[https://docker.222029.xyz:38083](https://docker.222029.xyz:38083) - -- `docker-compose.yml` - -```yaml -version: "3" -services: - nginx-php: - image: jetsung/nginx-php:latest - volumes: - - ./wwwroot:/data/wwwroot - - ./wwwlogs:/data/wwwlogs - - ./vhost:/usr/local/nginx/conf/vhost - - ./ssl:/usr/local/nginx/conf/ssl - ports: - - "38082:80" - - "38083:443" -``` - ---- - -### 定制扩展 - -``` -docker run -d -p 38084:80 \ --v $(pwd)/wwwroot:/data/wwwroot \ --v $(pwd)/wwwlogs:/data/wwwlogs \ --v $(pwd)/extension.sh:/app/extension.sh \ -jetsung/nginx-php -``` - -> 创建文件 `extension.sh` (不可更改文件名),内容为 [swoole](https://github.com/jetsung/docker-nginx-php/blob/main/extensions/swoole.sh) - -[http://docker.222029.xyz:38084](http://docker.222029.xyz:38084) - -- `docker-compose.yml` - -```yaml -version: "3" -services: - nginx-php: - image: jetsung/nginx-php:latest - volumes: - - ./wwwroot:/data/wwwroot - - ./wwwlogs:/data/wwwlogs - - ./extension.sh:/app/extension.sh - ports: - - "38084:80" -``` - -### [Changelog](https://github.com/jetsung/docker-nginx-php/blob/main/CHANGELOG.md) diff --git a/docs/_config.yml b/docs/_config.yml deleted file mode 100644 index 2da5da2c..00000000 --- a/docs/_config.yml +++ /dev/null @@ -1,11 +0,0 @@ -theme: jekyll-theme-cayman -title: nginx-php -description: Nginx PHP for Docker -encoding: UTF-8 -highlighter: rouge - -copyright: -year: 2018-2024 -name: Jetsung Chan - -timezone: Asia/Shanghai diff --git a/entrypoint.sh b/entrypoint.sh deleted file mode 100644 index baacf814..00000000 --- a/entrypoint.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -######################################################################### -# START -# File Name: entrypoint.sh -# Author: Jetsung Chan -# Email: jetsungchan@gmail.com -# Created: 2019/09/02 -# Updated: 2023/03/11 -######################################################################### - -set -e -set -u -set -o pipefail - -install_tools() { - apt-get update -y - apt-get install -y gcc \ - g++ \ - autoconf \ - automake \ - make \ - cmake -} - -clear_tools() { - apt-get remove -y gcc \ - g++ \ - autoconf \ - automake \ - make \ - cmake - apt-get autoremove -y - apt-get autoclean -y - apt-get clean -y -} - -# Add PHP Extension -install_extensions() { - if [ -f "/app/extension.sh" ] && [ ! -f /app/.installed ]; then - pushd /app >/dev/null || exit - install_tools - - bash extension.sh - date "+%F %T" >>/app/.installed - - #clear_tools - popd >/dev/null || exit - fi -} - -if [[ "${1}" = "-D" ]]; then - install_extensions 2>&1 | tee ./install.log - - # start supervisord and services - exec /usr/bin/supervisord -n -c /etc/supervisor/supervisord.conf -else - exec "$@" -fi diff --git a/example/README.md b/example/README.md deleted file mode 100644 index f803b1e9..00000000 --- a/example/README.md +++ /dev/null @@ -1,27 +0,0 @@ -## Example - -```bash -cd example - -docker run -p 8080:80 \ --p 8443:443 \ --v $(pwd)/wwwroot:/data/wwwroot \ --v $(pwd)/wwwlogs:/data/wwwlogs \ --v $(pwd)/vhost:/usr/local/nginx/conf/vhost \ --v $(pwd)/ssl:/usr/local/nginx/conf/ssl --v $(pwd)/extension.sh:/app/extension.sh \ --d jetsung/nginx-php:latest -``` - -### WEB - -- **HTTP**: http://127.0.0.1:8080 -- **HTTPS**: https://127.0.0.1:8443 - -If you modify the hosts, you can open the website with the domain. - -- https://docker.222029.xyz:8443 - -```bash -echo '0.0.0.0 docker.222029.xyz' >> /etc/hosts -``` diff --git a/example/docker-compose.yml b/example/docker-compose.yml deleted file mode 100644 index 7bb05246..00000000 --- a/example/docker-compose.yml +++ /dev/null @@ -1,34 +0,0 @@ -version: "3" - -x-image: &x-image - image: jetsung/nginx-php:latest - -services: - p38080: - <<: *x-image - ports: - - "38080:80" - p38081: - <<: *x-image - volumes: - - ./wwwroot:/data/wwwroot - ports: - - "38081:80" - p38082: - <<: *x-image - volumes: - - ./wwwroot:/data/wwwroot - - ./wwwlogs:/data/wwwlogs - - ./vhost:/usr/local/nginx/conf/vhost - - ./ssl:/usr/local/nginx/conf/ssl - ports: - - "38082:80" - - "38083:443" - p38084: - <<: *x-image - volumes: - - ./wwwroot:/data/wwwroot - - ./wwwlogs:/data/wwwlogs - - ./extension.sh:/app/extension.sh - ports: - - "38084:80" diff --git a/example/extension.sh b/example/extension.sh deleted file mode 100755 index b3d4f4f2..00000000 --- a/example/extension.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -install_swoole() { - curl -Lk https://github.com/swoole/swoole-src/archive/v4.8.13.tar.gz | gunzip | tar x - cd swoole-src-4.8.13 || exit - - phpize - ./configure --with-php-config=/usr/local/php/bin/php-config - make && make install - - EXTENSION_DIR=$(php-config --extension-dir) - if [ -f "$EXTENSION_DIR/swoole.so" ]; then - echo 'extension=swoole.so' >/usr/local/php/etc/php.d/03-swoole.ini - fi -} - -[ -d "/tmp/extension" ] || mkdir /tmp/extension - -pushd /tmp/extension || exit -UNINSTALLED=$(php --ri swoole | grep 'not present') -[ -z "$UNINSTALLED" ] || install_swoole -popd || exit diff --git a/example/ssl/full_chain.pem b/example/ssl/full_chain.pem deleted file mode 100644 index 716cc950..00000000 --- a/example/ssl/full_chain.pem +++ /dev/null @@ -1,51 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIEfzCCBCSgAwIBAgIQBOqE5SG8gOjYbPtQv0q23TAKBggqhkjOPQQDAjByMQsw -CQYDVQQGEwJDTjElMCMGA1UEChMcVHJ1c3RBc2lhIFRlY2hub2xvZ2llcywgSW5j -LjEdMBsGA1UECxMURG9tYWluIFZhbGlkYXRlZCBTU0wxHTAbBgNVBAMTFFRydXN0 -QXNpYSBUTFMgRUNDIENBMB4XDTIxMDcyMDAwMDAwMFoXDTIyMDcxOTIzNTk1OVow -GjEYMBYGA1UEAxMPZG9ja2VyLm1tYXBwLmNjMFkwEwYHKoZIzj0CAQYIKoZIzj0D -AQcDQgAEquV1mGKu5uoj4coPUrkKB96EHFxPSBMlkND0ycU9Ft6q7CdsiBjD+reh -lakiBlsturExJZQWR0maLfyWhP0uoKOCAvIwggLuMB8GA1UdIwQYMBaAFBKGRGYm -CFQmj2U3silOJiHgk77bMB0GA1UdDgQWBBQg8OlgWXX4hhZTz6gfXBz5qiXnwzAa -BgNVHREEEzARgg9kb2NrZXIubW1hcHAuY2MwDgYDVR0PAQH/BAQDAgeAMB0GA1Ud -JQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjA+BgNVHSAENzA1MDMGBmeBDAECATAp -MCcGCCsGAQUFBwIBFhtodHRwOi8vd3d3LmRpZ2ljZXJ0LmNvbS9DUFMwgZIGCCsG -AQUFBwEBBIGFMIGCMDQGCCsGAQUFBzABhihodHRwOi8vc3RhdHVzZi5kaWdpdGFs -Y2VydHZhbGlkYXRpb24uY29tMEoGCCsGAQUFBzAChj5odHRwOi8vY2FjZXJ0cy5k -aWdpdGFsY2VydHZhbGlkYXRpb24uY29tL1RydXN0QXNpYVRMU0VDQ0NBLmNydDAJ -BgNVHRMEAjAAMIIBfwYKKwYBBAHWeQIEAgSCAW8EggFrAWkAdgApeb7wnjk5IfBW -c59jpXflvld9nGAK+PlNXSZcJV3HhAAAAXrDjdcnAAAEAwBHMEUCIEMFK+mQTIg1 -+41PQE79Z9bHGxW/OtQ7RKBRCgqm7VprAiEAxxQdTzcy7AOo97PAIW35KAfz2YBO -IX8h+3Y6cjLOjBMAdwBRo7D1/QF5nFZtuDd4jwykeswbJ8v3nohCmg3+1IsF5QAA -AXrDjde7AAAEAwBIMEYCIQDB8ZebIvSi7jqAmepK6iPoHLq2iDgFY7PvxubTC466 -iQIhAOfj2w/eRm6j5TiHLNFJA0Tc0oBYqEJXIWOERyaQ4CMmAHYAQcjKsd8iRkoQ -xqE6CUKHXk4xixsD6+tLx2jwkGKWBvYAAAF6w43XRgAABAMARzBFAiEAvnBaHWyE -CnJft3bbOnXMS8+IJFQI8sQjkw6zmZ6HmzMCIF7dNf51q3vN6wcokBxJ25VJe/fx -g5B91h3B11SXniccMAoGCCqGSM49BAMCA0kAMEYCIQCLHbR9C2zzYY7qlm20QdU1 -TXQzFDum0flnig0+ksIUawIhANyQdxR9ux0WYTJX4VIPN8DwJEu9HtGdtfKWmVaL -ItYG ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIID4zCCAsugAwIBAgIQBz/JpHsGAhj24Khq6fw+OzANBgkqhkiG9w0BAQsFADBh -MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 -d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD -QTAeFw0xNzEyMDgxMjI4NTdaFw0yNzEyMDgxMjI4NTdaMHIxCzAJBgNVBAYTAkNO -MSUwIwYDVQQKExxUcnVzdEFzaWEgVGVjaG5vbG9naWVzLCBJbmMuMR0wGwYDVQQL -ExREb21haW4gVmFsaWRhdGVkIFNTTDEdMBsGA1UEAxMUVHJ1c3RBc2lhIFRMUyBF -Q0MgQ0EwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASdQvDzv44jBee0APcvKOWs -zZsRjc4j+L6DLlYOf9tSgvfOJplfMeDNDZzOQEcJbVPD+yekJQUmObCPOrgMhqMI -o4IBTzCCAUswHQYDVR0OBBYEFBKGRGYmCFQmj2U3silOJiHgk77bMB8GA1UdIwQY -MBaAFAPeUDVW0Uy7ZvCj4hsbw5eyPdFVMA4GA1UdDwEB/wQEAwIBhjAdBgNVHSUE -FjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwEgYDVR0TAQH/BAgwBgEB/wIBADA0Bggr -BgEFBQcBAQQoMCYwJAYIKwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmRpZ2ljZXJ0LmNv -bTBCBgNVHR8EOzA5MDegNaAzhjFodHRwOi8vY3JsMy5kaWdpY2VydC5jb20vRGln -aUNlcnRHbG9iYWxSb290Q0EuY3JsMEwGA1UdIARFMEMwNwYJYIZIAYb9bAECMCow -KAYIKwYBBQUHAgEWHGh0dHBzOi8vd3d3LmRpZ2ljZXJ0LmNvbS9DUFMwCAYGZ4EM -AQIBMA0GCSqGSIb3DQEBCwUAA4IBAQBZcGGhLE09CbQD5xP93NAuNC85G1BMa1OG -2Q01TWvvgp7Qt1wNfRLAnhQT5pb7kRs+E7nM4IS894ufmuL452q8gYaq5HmvOmfh -XMmL6K+eICfvyqjb/tSi8iy20ULO/TZhLhPor9tle52Yx811FG4i5vqwPIUEOEJ7 -pXe6RPVoBiwi4rbLspQGD/vYqrj9OJV4JctoIhhGq+y/sozU6nBXHfhVSD3x+hkO -Ost6tyRq481IyUWQHcFtwda3gfMnaA3dsag2dtJz33RIJIUfxXmVK7w4YzHOHifn -7TYk8iNrDDLtql6vS8FjiUx3kJnI6zge1C9lUHhZ/aD3RiTJrwWI ------END CERTIFICATE----- - diff --git a/example/ssl/private.key b/example/ssl/private.key deleted file mode 100644 index 5fce49ff..00000000 --- a/example/ssl/private.key +++ /dev/null @@ -1,6 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQg/BfXcai3L4u30njh -svZ30PcYsMO/T+JkOe+RqIahwiagCgYIKoZIzj0DAQehRANCAASq5XWYYq7m6iPh -yg9SuQoH3oQcXE9IEyWQ0PTJxT0W3qrsJ2yIGMP6t6GVqSIGWy26sTEllBZHSZot -/JaE/S6g ------END PRIVATE KEY----- diff --git a/example/vhost/localhost.conf b/example/vhost/localhost.conf deleted file mode 100644 index ac7fa233..00000000 --- a/example/vhost/localhost.conf +++ /dev/null @@ -1,54 +0,0 @@ -server { - listen 80; - server_name localhost docker.222029.xyz; - root /data/wwwroot; - index index.php index.html index.htm; - - #error_page 404 /404.html; - - # redirect server error pages to the static page /50x.html - # - # error_page 500 502 503 504 /50x.html; - # location = /50x.html { - # root html; - # } - - location / { - if (!-e $request_filename) { - rewrite ^(.*)$ /index.php?s=$1 last; - break; - } - } - - 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; - } - - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { - expires 30d; - access_log off; - } - - location ~ .*\.(js|css)?$ { - expires 7d; - access_log off; - } - - location ~ /\.(ht|git|vscode|idea) { - deny all; - } - - # https - listen 443 ssl http2; - ssl_certificate ssl/full_chain.pem; - ssl_certificate_key ssl/private.key; - ssl_protocols TLSv1.1 TLSv1.2; - ssl_prefer_server_ciphers on; - ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"; - keepalive_timeout 70; - ssl_session_cache shared:SSL:10m; - ssl_session_timeout 10m; -} diff --git a/example/wwwlogs/.gitkeep b/example/wwwlogs/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/example/wwwroot/index.html b/example/wwwroot/index.html deleted file mode 100644 index ff211417..00000000 --- a/example/wwwroot/index.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - Test Page - nginx-php Project - - - - - - - - \ No newline at end of file diff --git a/example/wwwroot/phpinfo.php b/example/wwwroot/phpinfo.php deleted file mode 100644 index e974c40d..00000000 --- a/example/wwwroot/phpinfo.php +++ /dev/null @@ -1 +0,0 @@ -/usr/local/php/etc/php.d/04-fileinfo.ini - fi -} - -[ -d "/tmp/extension" ] || mkdir /tmp/extension - -pushd /tmp/extension || exit -UNINSTALLED=$(php --ri fileinfo | grep 'not present') -[ -z "$UNINSTALLED" ] || install_fileinfo -popd || exit diff --git a/extensions/imagick.sh b/extensions/imagick.sh deleted file mode 100644 index bea031b2..00000000 --- a/extensions/imagick.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -install_imagemagick() { - curl -Lk https://ghproxy.com/https://github.com/ImageMagick/ImageMagick/archive/refs/tags/7.1.0-19.tar.gz | gunzip | tar x - - cd ImageMagick-7.1.0-19 || exit - ./configure --prefix=/usr/local/imagemagick --enable-shared --enable-static - make && make install - - cd .. -} - -install_pecl_imagick() { - apt-get install -y libmagickwand-dev - # or - # install_imagemagick - - curl -Lk https://pecl.php.net/get/imagick-3.6.0.tgz | gunzip | tar x - cd imagick-3.6.0 || exit - - phpize - ./configure --with-php-config=/usr/local/php/bin/php-config --with-imagick=/usr/local/imagemagick - make && make install - - EXTENSION_DIR=$(php-config --extension-dir) - if [ -f "$EXTENSION_DIR/imagick.so" ]; then - echo 'extension=imagick.so' >/usr/local/php/etc/php.d/03-imagick.ini - fi - - cd .. -} - -[ -d "/tmp/extension" ] || mkdir /tmp/extension - -pushd /tmp/extension || exit -UNINSTALLED=$(php --ri imagick | grep 'not present') -[ -z "$UNINSTALLED" ] || install_pecl_imagick -popd || exit diff --git a/extensions/imap.sh b/extensions/imap.sh deleted file mode 100644 index 44b658a1..00000000 --- a/extensions/imap.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -install_imap() { - apt-get install -y libc-client-dev libkrb5-dev - - PHP_VER=$(php-config --version) - [ -d "php-${PHP_VER}" ] || curl -Lk https://secure.php.net/distributions/php-"${PHP_VER}".tar.gz | gunzip | tar x - cd "php-$PHP_VER/ext/imap" || exit - - phpize - ./configure --with-php-config=/usr/local/php/bin/php-config --with-kerberos --with-imap --with-imap-ssl - make && make install - - EXTENSION_DIR=$(php-config --extension-dir) - if [ -f "$EXTENSION_DIR/imap.so" ]; then - echo 'extension=imap.so' >/usr/local/php/etc/php.d/04-imap.ini - fi -} - -[ -d "/tmp/extension" ] || mkdir /tmp/extension - -pushd /tmp/extension || exit -UNINSTALLED=$(php --ri imap | grep 'not present') -[ -z "$UNINSTALLED" ] || install_imap -popd || exit diff --git a/extensions/memcached.sh b/extensions/memcached.sh deleted file mode 100644 index 8edde0c3..00000000 --- a/extensions/memcached.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -install_pecl_memcached() { - apt-get install -y libmemcached-dev - - curl -Lk https://pecl.php.net/get/memcached-3.1.5.tgz | gunzip | tar x - cd memcached-3.1.5 || exit - - phpize - ./configure --with-php-config=/usr/local/php/bin/php-config - make && make install - - EXTENSION_DIR=$(php-config --extension-dir) - if [ -f "$EXTENSION_DIR/memcached.so" ]; then - echo 'extension=memcached.so' >/usr/local/php/etc/php.d/05-memcached.ini - fi - - cd .. -} - -install_pecl_memcache() { - curl -Lk https://pecl.php.net/get/memcache-8.0.tgz | gunzip | tar x - cd memcache-8.0 || exit - - phpize - ./configure --with-php-config=/usr/local/php/bin/php-config - make && make install - - EXTENSION_DIR=$(php-config --extension-dir) - if [ -f "$EXTENSION_DIR/memcache.so" ]; then - echo 'extension=memcache.so' >/usr/local/php/etc/php.d/05-memcache.ini - fi - - cd .. -} - -[ -d "/tmp/extension" ] || mkdir /tmp/extension - -pushd /tmp/extension || exit -UNINSTALLED=$(php --ri memcache | grep 'not present') -[ -z "$UNINSTALLED" ] || install_pecl_memcache - -UNINSTALLED=$(php --ri memcached | grep 'not present') -[ -z "$UNINSTALLED" ] || install_pecl_memcached -popd || exit diff --git a/extensions/merge.sh b/extensions/merge.sh deleted file mode 100755 index c3bce7c2..00000000 --- a/extensions/merge.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -######## 合并多个扩展安装文件 ############ - -READ_LINK=$(readlink -f "$0") -TOOLS_DIR=$(dirname "$READ_LINK") - -pushd "${TOOLS_DIR}" >/dev/null || exit - -EXTS=$(ls ./*.sh) -echo >./extension.sh - -for VAR in ${EXTS}; do - if [[ "$VAR" != "merge.sh" ]] && [[ "$VAR" != "extension.sh" ]]; then - cat "$VAR" >>./extension.sh - fi -done - -popd >/dev/null || exit diff --git a/extensions/opcache.sh b/extensions/opcache.sh deleted file mode 100644 index 0dc446c4..00000000 --- a/extensions/opcache.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -install_opcache() { - PHP_VER=$(php-config --version) - [ -d "php-$PHP_VER" ] || curl -Lk https://secure.php.net/distributions/php-"${PHP_VER}".tar.gz | gunzip | tar x - cd "php-$PHP_VER/ext/opcache" || exit - - phpize - ./configure --with-php-config=/usr/local/php/bin/php-config - make && make install - - EXTENSION_DIR=$(php-config --extension-dir) - if [ -f "$EXTENSION_DIR/opcache.so" ]; then - tee /usr/local/php/etc/php.d/08-opcache.ini <<-'EOF' -[Zend Opcache] -zend_extension=opcache.so -opcache.enable = 1 -opcache.memory_consumption=128 -opcache.interned_strings_buffer=8 -opcache.max_accelerated_files=4000 -opcache.revalidate_freq=60 -opcache.enable_cli=1 -EOF - fi -} - -[ -d "/tmp/extension" ] || mkdir /tmp/extension - -pushd /tmp/extension || exit -UNINSTALLED=$(php --rz "Zend OPcache" | grep 'does not exist') -[ -z "$UNINSTALLED" ] || install_opcache -popd || exit diff --git a/extensions/pq.sh b/extensions/pq.sh deleted file mode 100644 index 214bd131..00000000 --- a/extensions/pq.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -install_pecl_raphf() { - curl -Lk https://pecl.php.net/get/raphf-2.0.1.tgz | gunzip | tar x - cd raphf-2.0.1 || exit - - phpize - ./configure --with-php-config=/usr/local/php/bin/php-config - make && make install - - EXTENSION_DIR=$(php-config --extension-dir) - if [ -f "$EXTENSION_DIR/raphf.so" ]; then - echo 'extension=raphf.so' >/usr/local/php/etc/php.d/05-raphf.ini - fi - - cd .. -} - -install_pecl_pq() { - curl -Lk https://pecl.php.net/get/pq-2.2.0.tgz | gunzip | tar x - cd pq-2.2.0 || exit - - phpize - ./configure --with-php-config=/usr/local/php/bin/php-config - make && make install - - EXTENSION_DIR=$(php-config --extension-dir) - if [ -f "$EXTENSION_DIR/pq.so" ]; then - echo 'extension=pq.so' >/usr/local/php/etc/php.d/02-pq.ini - fi - - cd .. -} - -[ -d "/tmp/extension" ] || mkdir /tmp/extension - -pushd /tmp/extension || exit -UNINSTALLED=$(php --ri raphf | grep 'not present') -[ -z "$UNINSTALLED" ] || install_pecl_raphf - -INSTALLED_raphf=$(php --ri raphf | grep 'not present') -INSTALLED_pq=$(php --ri pq | grep 'not present') -if [ -n "$INSTALLED_pq" ] && [ -z "$INSTALLED_raphf" ]; then - install_pecl_pq -fi -popd || exit diff --git a/extensions/redis.sh b/extensions/redis.sh deleted file mode 100644 index fbf12156..00000000 --- a/extensions/redis.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -install_redis() { - curl -Lk https://pecl.php.net/get/redis-5.3.5.tgz | gunzip | tar x - cd redis-5.3.5 || exit - - phpize - ./configure --with-php-config=/usr/local/php/bin/php-config - make && make install - - EXTENSION_DIR=$(php-config --extension-dir) - if [ -f "$EXTENSION_DIR/redis.so" ]; then - echo 'extension=redis.so' >/usr/local/php/etc/php.d/05-redis.ini - fi -} - -[ -d "/tmp/extension" ] || mkdir /tmp/extension - -pushd /tmp/extension || exit -UNINSTALLED=$(php --ri redis | grep 'not present') -[ -z "$UNINSTALLED" ] || install_redis -popd || exit diff --git a/extensions/sqlsrv.sh b/extensions/sqlsrv.sh deleted file mode 100644 index 3794fab4..00000000 --- a/extensions/sqlsrv.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -install_pdo_sqlsrv() { - apt install -y unixodbc-dev - - curl -Lk http://pecl.php.net/get/pdo_sqlsrv-5.11.0.tgz | gunzip | tar x - cd pdo_sqlsrv-5.11.0 || exit - - phpize - ./configure --with-php-config=/usr/local/php/bin/php-config - make && make install - - EXTENSION_DIR=$(php-config --extension-dir) - if [ -f "$EXTENSION_DIR/pdo_sqlsrv.so" ]; then - echo 'extension=pdo_sqlsrv.so' >/usr/local/php/etc/php.d/02-sqlsrv.ini - fi -} - -[ -d "/tmp/extension" ] || mkdir /tmp/extension - -pushd /tmp/extension || exit -UNINSTALLED=$(php --ri pdo_sqlsrv | grep 'not present') -[ -z "$UNINSTALLED" ] || install_pdo_sqlsrv -popd || exit diff --git a/extensions/swoole.sh b/extensions/swoole.sh deleted file mode 100755 index d3b9fbc3..00000000 --- a/extensions/swoole.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -install_swoole() { - curl -Lk https://ghproxy.com/https://github.com/swoole/swoole-src/archive/v4.8.13.tar.gz | gunzip | tar x - cd swoole-src-4.8.13 || exit - - phpize - ./configure --with-php-config=/usr/local/php/bin/php-config - make && make install - - EXTENSION_DIR=$(php-config --extension-dir) - if [ -f "$EXTENSION_DIR/swoole.so" ]; then - echo 'extension=swoole.so' >/usr/local/php/etc/php.d/03-swoole.ini - fi -} - -[ -d "/tmp/extension" ] || mkdir /tmp/extension - -pushd /tmp/extension || exit -UNINSTALLED=$(php --ri swoole | grep 'not present') -[ -z "$UNINSTALLED" ] || install_swoole -popd || exit diff --git a/extfile/extension.sh b/extfile/extension.sh new file mode 100644 index 00000000..f401ee99 --- /dev/null +++ b/extfile/extension.sh @@ -0,0 +1,22 @@ +#!/bin/sh +######################################################################### +# File Name: extension.sh +# Author: Skiychan +# Email: dev@skiy.net +# Version: +# Created Time: 2016/08/03 +######################################################################### + +#Add extension xdebug +curl -Lk https://github.com/xdebug/xdebug/archive/XDEBUG_2_4_0RC3.tar.gz | gunzip | tar x -C /home/extension && \ +cd /home/extension/xdebug-XDEBUG_2_4_0RC3 && \ +/usr/local/php/bin/phpize && \ +./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config && \ +make && make install + +#Add extension mongodb +curl -Lk https://pecl.php.net/get/mongodb-1.1.8.tgz | gunzip | tar x -C /home/extension && \ +cd /home/extension/mongodb-1.1.8 && \ +/usr/local/php/bin/phpize && \ +./configure --with-php-config=/usr/local/php/bin/php-config && \ +make && make install \ No newline at end of file diff --git a/extini/mongodb.ini b/extini/mongodb.ini new file mode 100644 index 00000000..45969d06 --- /dev/null +++ b/extini/mongodb.ini @@ -0,0 +1 @@ +extension=mongodb.so diff --git a/extini/xdebug.ini b/extini/xdebug.ini new file mode 100644 index 00000000..29d9eff9 --- /dev/null +++ b/extini/xdebug.ini @@ -0,0 +1,13 @@ +[xdebug] +zend_extension = xdebug.so +xdebug.remote_enable = 1; +xdebug.remote_connect_back = 1; +xdebug.remote_port = 9999; +xdebug.remote_handler = dbgp; +xdebug.remote_autostart = 0; +xdebug.collect_return = on; +xdebug.collect_params = on; +xdebug.max_nesting_level = 100; +xdebug.profiler_enable= on; +xdebug.idekey = skiy; + diff --git a/index.php b/index.php new file mode 100644 index 00000000..593918b3 --- /dev/null +++ b/index.php @@ -0,0 +1,7 @@ + + +&2 'error: missing PROXY_DOMAIN' + echo >&2 ' Did you forget to add -e PROXY_DOMAIN=... ?' + exit 1 + fi + + if [ -z "$PROXY_CRT" ]; then + echo >&2 'error: missing PROXY_CRT' + echo >&2 ' Did you forget to add -e PROXY_CRT=... ?' + exit 1 + fi + + if [ -z "$PROXY_KEY" ]; then + echo >&2 'error: missing PROXY_KEY' + echo >&2 ' Did you forget to add -e PROXY_KEY=... ?' + exit 1 + fi + + if [ ! -f "${Nginx_Install_Dir}/conf/ssl/${PROXY_CRT}" ]; then + echo >&2 'error: missing PROXY_CRT' + echo >&2 " You need to put ${PROXY_CRT} in ssl directory" + exit 1 + fi + + if [ ! -f "${Nginx_Install_Dir}/conf/ssl/${PROXY_KEY}" ]; then + echo >&2 'error: missing PROXY_CSR' + echo >&2 " You need to put ${PROXY_KEY} in ssl directory" + exit 1 + fi + + cat > ${Nginx_Install_Dir}/conf/vhost/website.conf << EOF +server { + listen 80; + server_name $PROXY_DOMAIN; + return 301 https://$PROXY_DOMAIN\$request_uri; + } + +server { + listen 443 ssl; + server_name $PROXY_DOMAIN; + + ssl on; + ssl_certificate ssl/${PROXY_CRT}; + ssl_certificate_key ssl/${PROXY_KEY}; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_prefer_server_ciphers on; + ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"; + keepalive_timeout 70; + ssl_session_cache shared:SSL:10m; + ssl_session_timeout 10m; + + root $DATA_DIR; + index index.php index.html index.htm; + + location / { + try_files \$uri \$uri/ /index.php?\$args; + } + + location ~ \.php$ { + root /data/www; + fastcgi_pass 127.0.0.1:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME /\$document_root\$fastcgi_script_name; + include fastcgi_params; + } +} +EOF +fi + +/usr/bin/supervisord -n -c /etc/supervisord.conf diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 00000000..f3003263 --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,36 @@ +[unix_http_server] +file=/tmp/supervisor.sock ; (the path to the socket file) + +[supervisord] +logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log) +logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) +logfile_backups=10 ; (num of main logfile rotation backups;default 10) +loglevel=info ; (log level;default info; others: debug,warn,trace) +pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid) +nodaemon=false ; (start in foreground if true;default false) +minfds=1024 ; (min. avail startup file descriptors;default 1024) +minprocs=200 ; (min. avail process descriptors;default 200) +user=root ; + +; the below section must remain in the config file for RPC +; (supervisorctl/web interface) to work, additional interfaces may be +; added by defining them in separate rpcinterface: sections +[rpcinterface:supervisor] +supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + +[supervisorctl] +serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket + +[program:php-fpm] +command=/usr/local/php/sbin/php-fpm -F +autostart=true +autorestart=true +priority=5 + +[program:nginx] +command=/usr/local/nginx/sbin/nginx +autostart=true +autorestart=true +priority=10 +stdout_events_enabled=true +stderr_events_enabled=true diff --git a/supervisord/nginx.conf b/supervisord/nginx.conf deleted file mode 100644 index 988d9f12..00000000 --- a/supervisord/nginx.conf +++ /dev/null @@ -1,9 +0,0 @@ -[program:nginx] -command=/usr/local/nginx/sbin/nginx -g 'daemon off;' -c /usr/local/nginx/conf/nginx.conf -autostart=true -autorestart=true -priority=5 -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 diff --git a/supervisord/php-fpm.conf b/supervisord/php-fpm.conf deleted file mode 100644 index 3b4fba3e..00000000 --- a/supervisord/php-fpm.conf +++ /dev/null @@ -1,9 +0,0 @@ -[program:php-fpm] -command=/usr/local/php/sbin/php-fpm -F --fpm-config /usr/local/php/etc/php-fpm.conf -autostart=true -autorestart=true -priority=5 -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 \ No newline at end of file diff --git a/vhost/localhost.conf b/vhost/localhost.conf deleted file mode 100644 index 475bad77..00000000 --- a/vhost/localhost.conf +++ /dev/null @@ -1,54 +0,0 @@ -server { - listen 80; - server_name localhost; - root /data/wwwroot; - index index.php index.html index.htm; - - #error_page 404 /404.html; - - # redirect server error pages to the static page /50x.html - # - # error_page 500 502 503 504 /50x.html; - # location = /50x.html { - # root html; - # } - - location / { - if (!-e $request_filename) { - rewrite ^(.*)$ /index.php?s=$1 last; - break; - } - } - - 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; - } - - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { - expires 30d; - access_log off; - } - - location ~ .*\.(js|css)?$ { - expires 7d; - access_log off; - } - - location ~ /\.(ht|git|vscode|idea) { - deny all; - } - - # https - # listen 443 ssl http2; - # ssl_certificate ssl/localhost.crt; - # ssl_certificate_key ssl/localhost.key; - # ssl_protocols TLSv1 TLSv1.1 TLSv1.2; - # ssl_prefer_server_ciphers on; - # ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"; - # keepalive_timeout 70; - # ssl_session_cache shared:SSL:10m; - # ssl_session_timeout 10m; -} \ No newline at end of file diff --git a/www/helloworld.php b/www/helloworld.php deleted file mode 100644 index aaa10d6a..00000000 --- a/www/helloworld.php +++ /dev/null @@ -1 +0,0 @@ -