From f0aff2018b7d98480f1009792d9a718a1cc1573f Mon Sep 17 00:00:00 2001 From: skiy Date: Sat, 5 Dec 2015 03:01:43 +0800 Subject: [PATCH 01/67] add README --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..1e24f2c8 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Nginx and PHP for Docker From e92addc7639201a698e075a88e4bb2166ab0f1cf Mon Sep 17 00:00:00 2001 From: skiy Date: Sat, 5 Dec 2015 03:02:41 +0800 Subject: [PATCH 02/67] add files --- .DS_Store | Bin 0 -> 6148 bytes Dockerfile | 53 ++++++++ Nginx-init-Ubuntu | 336 ++++++++++++++++++++++++++++++++++++++++++++++ app.conf | 26 ++++ download.sh | 17 +++ nginx.conf | 88 ++++++++++++ nginx.sh | 119 ++++++++++++++++ php-7.sh | 198 +++++++++++++++++++++++++++ start.sh | 2 + 9 files changed, 839 insertions(+) create mode 100644 .DS_Store create mode 100644 Dockerfile create mode 100755 Nginx-init-Ubuntu create mode 100644 app.conf create mode 100644 download.sh create mode 100644 nginx.conf create mode 100644 nginx.sh create mode 100644 php-7.sh create mode 100644 start.sh diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 + +RUN apt-get update && \ + apt-get install -y \ + wget \ + build-essential \ + libssl-dev \ + libxml2-dev \ + libcurl4-openssl-dev \ + pkg-config \ + libjpeg-dev \ + libpng-dev \ + libpng-dev \ + libfreetype6-dev + +RUN mkdir -p /home/nginx-php7 + +#ADD nginx.sh /home/nginx-php7/ +#ADD php-7.sh /home/nginx-php7/ +#ADD download.sh /home/nginx-php7/ +#ADD app.conf /home/nginx-php7/ +#ADD nginx.conf /home/nginx-php7/ +#ADD Nginx-init-Ubuntu /home/nginx-php7/ + +COPY . /home/nginx-php7 + +# Start Supervisord +ADD ./start.sh /start.sh +RUN chmod 755 /start.sh + +VOLUME ["/data/www"] + +RUN chmod +x /home/nginx-php7/*.sh + +RUN cd /home/nginx-php7/ && \ + . ./app.conf && \ + . ./download.sh && \ + . ./nginx.sh && \ + mkdir src && \ + Install_Nginx +RUN cd /home/nginx-php7/ && \ + . ./app.conf && \ + . ./download.sh && \ + . ./php-7.sh && \ + Install_PHP7 && \ + +RUN cd .. && \ + rm -rf /home/nginx-php7 + +EXPOSE 80 + +CMD ["/bin/bash", "/start.sh"] diff --git a/Nginx-init-Ubuntu b/Nginx-init-Ubuntu new file mode 100755 index 00000000..770a95db --- /dev/null +++ b/Nginx-init-Ubuntu @@ -0,0 +1,336 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: nginx +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: nginx init.d dash script for Ubuntu <=9.10. +# Description: nginx init.d dash script for Ubuntu <=9.10. +### END INIT INFO +#------------------------------------------------------------------------------ +# nginx - this Debian Almquist shell (dash) script, starts and stops the nginx +# daemon for ubuntu 9.10 and lesser version numbered releases. +# +# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ +# proxy and IMAP/POP3 proxy server. This \ +# script will manage the initiation of the \ +# server and it's process state. +# +# processname: nginx +# config: /usr/local/nginx/conf/nginx.conf +# pidfile: /var/run/nginx.pid +# Provides: nginx +# +# Author: Jason Giedymin +# . +# +# Version: 2.0 02-NOV-2009 jason.giedymin AT gmail.com +# Notes: nginx init.d dash script for Ubuntu <=9.10. +# +# This script's project home is: +# http://code.google.com/p/nginx-init-ubuntu/ +# +#------------------------------------------------------------------------------ +# Functions +#------------------------------------------------------------------------------ +. /lib/lsb/init-functions + +#------------------------------------------------------------------------------ +# Consts +#------------------------------------------------------------------------------ +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/local/nginx/sbin/nginx + +PS="nginx" +PIDNAME="nginx" #lets you do $PS-slave +PIDFILE=$PIDNAME.pid #pid file +PIDSPATH=/var/run + +DESCRIPTION="Nginx Server..." + +RUNAS=root #user to run as + +SCRIPT_OK=0 #ala error codes +SCRIPT_ERROR=1 #ala error codes +TRUE=1 #boolean +FALSE=0 #boolean + +lockfile=/var/lock/subsys/nginx +NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" + +#------------------------------------------------------------------------------ +# Simple Tests +#------------------------------------------------------------------------------ + +#test if nginx is a file and executable +test -x $DAEMON || exit 0 + +# Include nginx defaults if available +if [ -f /etc/default/nginx ] ; then + . /etc/default/nginx +fi + +#set exit condition +#set -e + +#------------------------------------------------------------------------------ +# Functions +#------------------------------------------------------------------------------ + +setFilePerms(){ + + if [ -f $PIDSPATH/$PIDFILE ]; then + chmod 400 $PIDSPATH/$PIDFILE + fi +} + +configtest() { + $DAEMON -t -c $NGINX_CONF_FILE +} + +getPSCount() { + return `pgrep -f $PS | wc -l` +} + +isRunning() { + if [ $1 ]; then + pidof_daemon $1 + PID=$? + + if [ $PID -gt 0 ]; then + return 1 + else + return 0 + fi + else + pidof_daemon + PID=$? + + if [ $PID -gt 0 ]; then + return 1 + else + return 0 + fi + fi +} + +#courtesy of php-fpm +wait_for_pid () { + try=0 + + while test $try -lt 35 ; do + + case "$1" in + 'created') + if [ -f "$2" ] ; then + try='' + break + fi + ;; + + 'removed') + if [ ! -f "$2" ] ; then + try='' + break + fi + ;; + esac + + #echo -n . + try=`expr $try + 1` + sleep 1 + done +} + +status(){ + isRunning + isAlive=$? + + if [ "${isAlive}" -eq $TRUE ]; then + echo "$PIDNAME found running with processes: `pidof $PS`" + else + echo "$PIDNAME is NOT running." + fi + + +} + +removePIDFile(){ + if [ $1 ]; then + if [ -f $1 ]; then + rm -f $1 + fi + else + #Do default removal + if [ -f $PIDSPATH/$PIDFILE ]; then + rm -f $PIDSPATH/$PIDFILE + fi + fi +} + +start() { + log_daemon_msg "Starting $DESCRIPTION" + + isRunning + isAlive=$? + + if [ "${isAlive}" -eq $TRUE ]; then + log_end_msg $SCRIPT_ERROR + else + start-stop-daemon --start --quiet --chuid $RUNAS --pidfile $PIDSPATH/$PIDFILE --exec $DAEMON \ + -- -c $NGINX_CONF_FILE + setFilePerms + log_end_msg $SCRIPT_OK + fi +} + +stop() { + log_daemon_msg "Stopping $DESCRIPTION" + + isRunning + isAlive=$? + if [ "${isAlive}" -eq $TRUE ]; then + start-stop-daemon --stop --quiet --pidfile $PIDSPATH/$PIDFILE + + wait_for_pid 'removed' $PIDSPATH/$PIDFILE + + if [ -n "$try" ] ; then + log_end_msg $SCRIPT_ERROR + else + removePIDFile + log_end_msg $SCRIPT_OK + fi + + else + log_end_msg $SCRIPT_ERROR + fi +} + +reload() { + configtest || return $? + + log_daemon_msg "Reloading (via HUP) $DESCRIPTION" + + isRunning + if [ $? -eq $TRUE ]; then + `killall -HUP $PS` #to be safe + + log_end_msg $SCRIPT_OK + else + log_end_msg $SCRIPT_ERROR + fi +} + +quietupgrade() { + log_daemon_msg "Peforming Quiet Upgrade $DESCRIPTION" + + isRunning + isAlive=$? + if [ "${isAlive}" -eq $TRUE ]; then + kill -USR2 `cat $PIDSPATH/$PIDFILE` + kill -WINCH `cat $PIDSPATH/$PIDFILE.oldbin` + + isRunning + isAlive=$? + if [ "${isAlive}" -eq $TRUE ]; then + kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` + wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin + removePIDFile $PIDSPATH/$PIDFILE.oldbin + + log_end_msg $SCRIPT_OK + else + log_end_msg $SCRIPT_ERROR + + log_daemon_msg "ERROR! Reverting back to original $DESCRIPTION" + + kill -HUP `cat $PIDSPATH/$PIDFILE` + kill -TERM `cat $PIDSPATH/$PIDFILE.oldbin` + kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` + + wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin + removePIDFile $PIDSPATH/$PIDFILE.oldbin + + log_end_msg $SCRIPT_ok + fi + else + log_end_msg $SCRIPT_ERROR + fi +} + +terminate() { + log_daemon_msg "Force terminating (via KILL) $DESCRIPTION" + + PIDS=`pidof $PS` || true + + [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` + + for i in $PIDS; do + if [ "$i" = "$PIDS2" ]; then + kill $i + wait_for_pid 'removed' $PIDSPATH/$PIDFILE + removePIDFile + fi + done + + log_end_msg $SCRIPT_OK +} + +destroy() { + log_daemon_msg "Force terminating and may include self (via KILLALL) $DESCRIPTION" + killall $PS -q >> /dev/null 2>&1 + log_end_msg $SCRIPT_OK +} + +pidof_daemon() { + PIDS=`pidof $PS` || true + + [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` + + for i in $PIDS; do + if [ "$i" = "$PIDS2" ]; then + return 1 + fi + done + return 0 +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|force-reload) + stop + sleep 3 + start + ;; + reload) + $1 + ;; + status) + status + ;; + configtest) + $1 + ;; + quietupgrade) + $1 + ;; + terminate) + $1 + ;; + destroy) + $1 + ;; + *) + FULLPATH=/etc/init.d/$PS + echo "Usage: $FULLPATH {start|stop|restart|force-reload|status|configtest|quietupgrade|terminate|destroy}" + echo " The 'destroy' command should only be used as a last resort." + exit 1 + ;; +esac + +exit 0 diff --git a/app.conf b/app.conf new file mode 100644 index 00000000..bd4a0bc7 --- /dev/null +++ b/app.conf @@ -0,0 +1,26 @@ +pcre_version=8.37 +nginx_version=1.9.7 +php_7_version=7.0.0 + +# operating environment for the current working directory +oneinstack_dir= + +# Nginx Apache and PHP-FPM process is run as $run_user(Default "www"), you can freely specify +run_user=www + +# set the default install path, you can freely specify +nginx_install_dir=/usr/local/nginx +php_install_dir=/usr/local/php + +# web directory, you can customize +wwwroot_dir=/data/www + +# nginx Generate a log storage directory, you can freely specify. +wwwlogs_dir=/data/logs + +data_dir=/home/nginx-php7 + +libiconv_version=1.14 +libmcrypt_version=2.5.8 +mcrypt_version=2.6.8 +mhash_version=0.9.9.9 \ No newline at end of file diff --git a/download.sh b/download.sh new file mode 100644 index 00000000..9fc77510 --- /dev/null +++ b/download.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Author: yeho +# BLOG: https://blog.linuxeye.com +# +# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ +# +# Project home page: +# http://oneinstack.com +# https://github.com/lj2007331/oneinstack + +Download_src() { + [ -s "${src_url##*/}" ] && echo "[${CMSG}${src_url##*/}${CEND}] found" || wget -c --no-check-certificate $src_url + if [ ! -e "${src_url##*/}" ];then + echo "${CFAILURE}${src_url##*/} download failed, Please contact the author! ${CEND}" + kill -9 $$ + fi +} diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 00000000..15a2c5c3 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,88 @@ +user www www; +worker_processes auto; + +error_log /data/logs/error_nginx.log crit; +pid /var/run/nginx.pid; +worker_rlimit_nofile 51200; + +events { + use epoll; + worker_connections 51200; + } + +http { + include mime.types; + default_type application/octet-stream; + server_names_hash_bucket_size 128; + client_header_buffer_size 32k; + large_client_header_buffers 4 32k; + client_max_body_size 50m; + sendfile on; + tcp_nopush on; + keepalive_timeout 120; + server_tokens off; + tcp_nodelay on; + + fastcgi_connect_timeout 300; + fastcgi_send_timeout 300; + fastcgi_read_timeout 300; + fastcgi_buffer_size 64k; + fastcgi_buffers 4 64k; + fastcgi_busy_buffers_size 128k; + fastcgi_temp_file_write_size 128k; + + #Gzip Compression + gzip on; + gzip_buffers 16 8k; + gzip_comp_level 6; + gzip_http_version 1.1; + gzip_min_length 256; + gzip_proxied any; + gzip_vary on; + gzip_types + text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml + text/javascript application/javascript application/x-javascript + text/x-json application/json application/x-web-app-manifest+json + text/css text/plain text/x-component + font/opentype application/x-font-ttf application/vnd.ms-fontobject + image/x-icon; + gzip_disable "msie6"; + + #If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency. + open_file_cache max=1000 inactive=20s; + open_file_cache_valid 30s; + open_file_cache_min_uses 2; + open_file_cache_errors on; + +######################## default ############################ + server { + listen 80; + server_name _; + access_log /data/logs/access_nginx.log combined; + root /data/www; + index index.html index.htm index.php; + location /nginx_status { + stub_status on; + access_log off; + allow 127.0.0.1; + deny all; + } + location ~ .*\.(php|php5)?$ { + #fastcgi_pass remote_php_ip:9000; + fastcgi_pass unix:/dev/shm/php-cgi.sock; + fastcgi_index index.php; + include fastcgi.conf; + } + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { + expires 30d; + access_log off; + } + location ~ .*\.(js|css)?$ { + expires 7d; + access_log off; + } + } + +########################## vhost ############################# + include vhost/*.conf; +} diff --git a/nginx.sh b/nginx.sh new file mode 100644 index 00000000..1f0aa73a --- /dev/null +++ b/nginx.sh @@ -0,0 +1,119 @@ +#!/bin/bash +# Author: yeho +# BLOG: https://blog.linuxeye.com +# +# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ +# +# Project home page: +# http://oneinstack.com +# https://github.com/lj2007331/oneinstack + +Install_Nginx() +{ +cd src +src_url=http://downloads.sourceforge.net/project/pcre/pcre/$pcre_version/pcre-$pcre_version.tar.gz && Download_src +src_url=http://nginx.org/download/nginx-$nginx_version.tar.gz && Download_src + +tar xzf pcre-$pcre_version.tar.gz +cd pcre-$pcre_version +./configure +make && make install +cd .. + +id -u $run_user >/dev/null 2>&1 +[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user + +tar xzf nginx-$nginx_version.tar.gz +cd nginx-$nginx_version +# Modify Nginx version +#sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/nginx.h +#sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye/" NGINX_VERSION@' src/core/nginx.h +#sed -i 's@Server: nginx@Server: linuxeye@' src/http/ngx_http_header_filter_module.c + +# close debug +sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc + +if [ "$je_tc_malloc" = '1' ];then + malloc_module="--with-ld-opt='-ljemalloc'" +elif [ "$je_tc_malloc" = '2' ];then + malloc_module='--with-google_perftools_module' + mkdir /tmp/tcmalloc + chown -R ${run_user}.$run_user /tmp/tcmalloc +fi + +[ ! -d "$nginx_install_dir" ] && mkdir -p $nginx_install_dir +./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module $malloc_module +make && make install +if [ -e "$nginx_install_dir/conf/nginx.conf" ];then + cd .. + rm -rf nginx-$nginx_version + echo "${CSUCCESS}Nginx install successfully! ${CEND}" +else + rm -rf $nginx_install_dir + echo "${CFAILURE}Nginx install failed, Please Contact the author! ${CEND}" + kill -9 $$ +fi + +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$nginx_install_dir/sbin:\$PATH" >> /etc/profile +[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $nginx_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$nginx_install_dir/sbin:\1@" /etc/profile +. /etc/profile + +#OS_command + + +echo "/bin/cp $data_dir/Nginx-init-Ubuntu /etc/init.d/nginx" | bash +echo "update-rc.d nginx defaults" | bash + +cd .. + +sed -i "s@/usr/local/nginx@$nginx_install_dir@g" /etc/init.d/nginx +mv $nginx_install_dir/conf/nginx.conf $nginx_install_dir/conf/nginx.conf_bk +cp $data_dir/nginx.conf $nginx_install_dir/conf/nginx.conf + +[ -z "`grep '/php-fpm_status' $nginx_install_dir/conf/nginx.conf`" ] && sed -i "s@index index.html index.php;@index index.html index.php;\n location ~ /php-fpm_status {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi.conf;\n allow 127.0.0.1;\n deny all;\n }@" $nginx_install_dir/conf/nginx.conf + +cat > $nginx_install_dir/conf/proxy.conf << EOF +proxy_connect_timeout 300s; +proxy_send_timeout 900; +proxy_read_timeout 900; +proxy_buffer_size 32k; +proxy_buffers 4 64k; +proxy_busy_buffers_size 128k; +proxy_redirect off; +proxy_hide_header Vary; +proxy_set_header Accept-Encoding ''; +proxy_set_header Referer \$http_referer; +proxy_set_header Cookie \$http_cookie; +proxy_set_header Host \$host; +proxy_set_header X-Real-IP \$remote_addr; +proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; +EOF + +mkdir $wwwlogs_dir + +sed -i "s@/data/www@$wwwroot_dir@" $nginx_install_dir/conf/nginx.conf +sed -i "s@/data/logs@$wwwlogs_dir@g" $nginx_install_dir/conf/nginx.conf +sed -i "s@^user www www@user $run_user $run_user@" $nginx_install_dir/conf/nginx.conf +[ "$je_tc_malloc" = '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $nginx_install_dir/conf/nginx.conf + +# logrotate nginx log +cat > /etc/logrotate.d/nginx << EOF +$wwwlogs_dir/*nginx.log { +daily +rotate 5 +missingok +dateext +compress +notifempty +sharedscripts +postrotate + [ -e /var/run/nginx.pid ] && kill -USR1 \`cat /var/run/nginx.pid\` +endscript +} +EOF + +echo "> /data/www/index.php + +ldconfig +service nginx start +} diff --git a/php-7.sh b/php-7.sh new file mode 100644 index 00000000..d56674d2 --- /dev/null +++ b/php-7.sh @@ -0,0 +1,198 @@ +#!/bin/bash +# Author: yeho +# BLOG: https://blog.linuxeye.com +# +# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ +# +# Project home page: +# http://oneinstack.com +# https://github.com/lj2007331/oneinstack + +Install_PHP7() +{ + +#cd $data_dir/src +cd src +src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$libiconv_version.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/$libmcrypt_version/libmcrypt-$libmcrypt_version.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mhash/mhash/$mhash_version/mhash-$mhash_version.tar.gz && Download_src +src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/$mcrypt_version/mcrypt-$mcrypt_version.tar.gz && Download_src +src_url=http://www.php.net/distributions/php-$php_7_version.tar.gz && Download_src + +tar xzf libiconv-$libiconv_version.tar.gz +cd libiconv-$libiconv_version +./configure --prefix=/usr/local +[ "$Ubuntu_version" == '13' ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h +[ "$Ubuntu_version" == '14' ] && sed -i 's@gets is a security@@' srclib/stdio.h +make && make install +cd .. +rm -rf libiconv-$libiconv_version + +tar xzf libmcrypt-$libmcrypt_version.tar.gz +cd libmcrypt-$libmcrypt_version +./configure +make && make install +ldconfig +cd libltdl +./configure --enable-ltdl-install +make && make install +cd ../../ +rm -rf libmcrypt-$libmcrypt_version + +tar xzf mhash-$mhash_version.tar.gz +cd mhash-$mhash_version +./configure +make && make install +cd .. +rm -rf mhash-$mhash_version + +echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf +ldconfig +OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n +if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n + ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 \n +else \n + ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 \n +fi' + +tar xzf mcrypt-$mcrypt_version.tar.gz +cd mcrypt-$mcrypt_version +ldconfig +./configure +make && make install +cd .. +rm -rf mcrypt-$mcrypt_version + +id -u $run_user >/dev/null 2>&1 +[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user + +tar xzf php-$php_7_version.tar.gz +cd php-$php_7_version +make clean +./buildconf +[ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir + + ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ +--with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm --disable-fileinfo \ +--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ +--with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ +--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ +--enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ +--enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ +--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp \ +--with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug + +make ZEND_EXTRA_LIBS='-liconv' +make install + +if [ -e "$php_install_dir/bin/phpize" ];then + echo "${CSUCCESS}PHP install successfully! ${CEND}" +else + rm -rf $php_install_dir + echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}" + kill -9 $$ +fi + +[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile +[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile +. /etc/profile + +# wget -c http://pear.php.net/go-pear.phar +# $php_install_dir/bin/php go-pear.phar + +/bin/cp php.ini-production $php_install_dir/etc/php.ini + +sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini +sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini +sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini +sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini +sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini +sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini +sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini +sed -i 's@^post_max_size.*@post_max_size = 50M@' $php_install_dir/etc/php.ini +sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini +sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.ini +sed -i 's@^max_execution_time.*@max_execution_time = 600@' $php_install_dir/etc/php.ini +sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' $php_install_dir/etc/php.ini +sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini +sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini +sed -i 's@^mysqlnd.collect_memory_statistics.*@mysqlnd.collect_memory_statistics = On@' $php_install_dir/etc/php.ini +[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini + + +# php-fpm Init Script +/bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm +chmod +x /etc/init.d/php-fpm + +OS_Debian_Ubuntu='update-rc.d php-fpm defaults' + +cat > $php_install_dir/etc/php-fpm.conf < Date: Sat, 5 Dec 2015 03:05:39 +0800 Subject: [PATCH 03/67] update --- Dockerfile | 22 +++++++++++++++------- index.php | 5 +++++ nginx.sh | 3 --- php-7.sh | 9 ++++++--- start.sh | 3 +-- supervisord.conf | 37 +++++++++++++++++++++++++++++++++++++ 6 files changed, 64 insertions(+), 15 deletions(-) create mode 100644 index.php create mode 100644 supervisord.conf diff --git a/Dockerfile b/Dockerfile index f54dac02..ebfe643c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM ubuntu:14.04 MAINTAINER Skiychan +#Install update & library RUN apt-get update && \ apt-get install -y \ wget \ @@ -14,6 +15,7 @@ RUN apt-get update && \ libpng-dev \ libfreetype6-dev +#Create folder RUN mkdir -p /home/nginx-php7 #ADD nginx.sh /home/nginx-php7/ @@ -23,31 +25,37 @@ RUN mkdir -p /home/nginx-php7 #ADD nginx.conf /home/nginx-php7/ #ADD Nginx-init-Ubuntu /home/nginx-php7/ +#Copy files to folder COPY . /home/nginx-php7 +#Make sh to run +RUN chmod +x /home/nginx-php7/*.sh # Start Supervisord +ADD ./supervisord.conf /etc/supervisord.conf ADD ./start.sh /start.sh -RUN chmod 755 /start.sh +RUN chmod +x /start.sh +#Web folder VOLUME ["/data/www"] +COPY ./index.php /data/www/index.php -RUN chmod +x /home/nginx-php7/*.sh - +#Install nginx RUN cd /home/nginx-php7/ && \ . ./app.conf && \ . ./download.sh && \ . ./nginx.sh && \ mkdir src && \ Install_Nginx + +#Install PHP RUN cd /home/nginx-php7/ && \ . ./app.conf && \ . ./download.sh && \ . ./php-7.sh && \ - Install_PHP7 && \ + Install_PHP7 -RUN cd .. && \ - rm -rf /home/nginx-php7 - +#Set port EXPOSE 80 +#Start web server CMD ["/bin/bash", "/start.sh"] diff --git a/index.php b/index.php new file mode 100644 index 00000000..5f1148a3 --- /dev/null +++ b/index.php @@ -0,0 +1,5 @@ +> /data/www/index.php - ldconfig -service nginx start } diff --git a/php-7.sh b/php-7.sh index d56674d2..cfe92768 100644 --- a/php-7.sh +++ b/php-7.sh @@ -190,9 +190,12 @@ sed -i "s@^pm.min_spare_servers.*@pm.min_spare_servers = 70@" $php_install_dir/e sed -i "s@^pm.max_spare_servers.*@pm.max_spare_servers = 120@" $php_install_dir/etc/php-fpm.conf #[ "$Web_yn" == 'n' ] && sed -i "s@^listen =.*@listen = $IPADDR:9000@" $php_install_dir/etc/php-fpm.conf -service php-fpm start -cd .. +#delete the files +cd /data + +[ -e "$data_dir" ] && rm -rf $data_dir + [ -e "$php_install_dir/bin/phpize" ] && rm -rf php-$php_7_version -cd .. + } diff --git a/start.sh b/start.sh index f962aed2..435c7393 100644 --- a/start.sh +++ b/start.sh @@ -1,2 +1 @@ -service nginx start -service php-fpm start \ No newline at end of file +/usr/bin/supervisord -n -c /etc/supervisord.conf \ No newline at end of file diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 00000000..e705aa34 --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,37 @@ +[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 +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 + From 7e11ff11bb0789bbd7b2b6ca21036e6532c70f2d Mon Sep 17 00:00:00 2001 From: skiy Date: Sat, 5 Dec 2015 11:21:28 +0800 Subject: [PATCH 04/67] add supervisor --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ebfe643c..76cc3502 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,8 @@ RUN apt-get update && \ libjpeg-dev \ libpng-dev \ libpng-dev \ - libfreetype6-dev + libfreetype6-dev \ + supervisor #Create folder RUN mkdir -p /home/nginx-php7 From 513a14a405e3f35c07788360bd823126a45012e7 Mon Sep 17 00:00:00 2001 From: skiy Date: Sun, 13 Dec 2015 12:23:05 +0800 Subject: [PATCH 05/67] replace install step with tar.gz --- .DS_Store | Bin 6148 -> 0 bytes Dockerfile | 119 +++++++++------- Nginx-init-Ubuntu | 336 ---------------------------------------------- app.conf | 26 ---- download.sh | 17 --- nginx.conf | 182 +++++++++++++++---------- nginx.sh | 116 ---------------- php-7.sh | 201 --------------------------- start.sh | 3 +- supervisord.conf | 37 ----- 10 files changed, 177 insertions(+), 860 deletions(-) delete mode 100644 .DS_Store delete mode 100755 Nginx-init-Ubuntu delete mode 100644 app.conf delete mode 100644 download.sh delete mode 100644 nginx.sh delete mode 100644 php-7.sh delete mode 100644 supervisord.conf diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 -#Install update & library -RUN apt-get update && \ - apt-get install -y \ - wget \ - build-essential \ - libssl-dev \ - libxml2-dev \ - libcurl4-openssl-dev \ - pkg-config \ - libjpeg-dev \ - libpng-dev \ - libpng-dev \ - libfreetype6-dev \ - supervisor - -#Create folder -RUN mkdir -p /home/nginx-php7 - -#ADD nginx.sh /home/nginx-php7/ -#ADD php-7.sh /home/nginx-php7/ -#ADD download.sh /home/nginx-php7/ -#ADD app.conf /home/nginx-php7/ -#ADD nginx.conf /home/nginx-php7/ -#ADD Nginx-init-Ubuntu /home/nginx-php7/ - -#Copy files to folder -COPY . /home/nginx-php7 -#Make sh to run -RUN chmod +x /home/nginx-php7/*.sh - -# Start Supervisord -ADD ./supervisord.conf /etc/supervisord.conf -ADD ./start.sh /start.sh -RUN chmod +x /start.sh +#Install system library +RUN yum -y install \ + gcc \ + gcc-c++ \ + autoconf \ + automake \ + libtool \ + make \ + cmake + +#Install PHP library +## libmcrypt-devel DIY +RUN rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm && \ + yum install -y wget \ + zlib \ + zlib-devel \ + openssl \ + openssl-devel \ + pcre-devel \ + libxml2 \ + libxml2-devel \ + libcurl \ + libcurl-devel \ + libjpeg-devel \ + libpng-devel \ + freetype-devel \ + libmcrypt-devel && \ + yum clean all + +#Download & Make install nginx +RUN cd /home && \ + wget -c http://nginx.org/download/nginx-1.9.9.tar.gz && \ + tar -zxvf nginx-1.9.9.tar.gz && \ + cd nginx-1.9.9 && \ +./configure --prefix=/usr/local/nginx --pid-path=/usr/local/nginx/run/nginx.pid --with-http_ssl_module --with-pcre --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module && \ + make && \ + make install + +RUN cd /home && \ + wget -O php-7.0.0.tar.gz http://am1.php.net/get/php-7.0.0.tar.gz/from/this/mirror && \ + tar zvxf php-7.0.0.tar.gz && \ + cd php-7.0.0 && \ +./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc --with-config-file-scan-dir=/usr/local/php7/etc/php.d --with-mcrypt=/usr/include --enable-mysqlnd --with-mysqli --with-pdo-mysql --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-gd --with-iconv --with-zlib --enable-xml --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache && \ + make && \ + make install && \ + cp php.ini-production /usr/local/php7/etc/php.ini && \ + cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf && \ + cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf -#Web folder +#Remove zips +#RUN cd / && rm -rf /home/* + +#Create web folder +RUN mkdir -p /data/www VOLUME ["/data/www"] -COPY ./index.php /data/www/index.php - -#Install nginx -RUN cd /home/nginx-php7/ && \ - . ./app.conf && \ - . ./download.sh && \ - . ./nginx.sh && \ - mkdir src && \ - Install_Nginx - -#Install PHP -RUN cd /home/nginx-php7/ && \ - . ./app.conf && \ - . ./download.sh && \ - . ./php-7.sh && \ - Install_PHP7 +ADD ./index.php /data/www/index.php +#RUN chown -Rf www-data.www-data /data/www + +#Update nginx config +#ADD ./nginx.conf /usr/local/nginx/conf/nginx.conf +#RUN sed -i -e"s/worker_processes 1/worker_processes 5/" /usr/local/nginx/conf/nginx.conf && \ +#sed -i -e"s/keepalive_timeout\s*65/keepalive_timeout 2/" /usr/local/nginx/conf/nginx.conf && \ +#sed -i -e"s/keepalive_timeout 2/keepalive_timeout 2;\n\tclient_max_body_size 100m/" /usr/local/nginx/conf/nginx.conf && \ +#echo "daemon off;" >> /usr/local/nginx/conf/nginx.conf + +#Start +ADD ./start.sh /start.sh +RUN chmod +x /start.sh #Set port EXPOSE 80 diff --git a/Nginx-init-Ubuntu b/Nginx-init-Ubuntu deleted file mode 100755 index 770a95db..00000000 --- a/Nginx-init-Ubuntu +++ /dev/null @@ -1,336 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: nginx -# Required-Start: $remote_fs $syslog -# Required-Stop: $remote_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: nginx init.d dash script for Ubuntu <=9.10. -# Description: nginx init.d dash script for Ubuntu <=9.10. -### END INIT INFO -#------------------------------------------------------------------------------ -# nginx - this Debian Almquist shell (dash) script, starts and stops the nginx -# daemon for ubuntu 9.10 and lesser version numbered releases. -# -# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ -# proxy and IMAP/POP3 proxy server. This \ -# script will manage the initiation of the \ -# server and it's process state. -# -# processname: nginx -# config: /usr/local/nginx/conf/nginx.conf -# pidfile: /var/run/nginx.pid -# Provides: nginx -# -# Author: Jason Giedymin -# . -# -# Version: 2.0 02-NOV-2009 jason.giedymin AT gmail.com -# Notes: nginx init.d dash script for Ubuntu <=9.10. -# -# This script's project home is: -# http://code.google.com/p/nginx-init-ubuntu/ -# -#------------------------------------------------------------------------------ -# Functions -#------------------------------------------------------------------------------ -. /lib/lsb/init-functions - -#------------------------------------------------------------------------------ -# Consts -#------------------------------------------------------------------------------ -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -DAEMON=/usr/local/nginx/sbin/nginx - -PS="nginx" -PIDNAME="nginx" #lets you do $PS-slave -PIDFILE=$PIDNAME.pid #pid file -PIDSPATH=/var/run - -DESCRIPTION="Nginx Server..." - -RUNAS=root #user to run as - -SCRIPT_OK=0 #ala error codes -SCRIPT_ERROR=1 #ala error codes -TRUE=1 #boolean -FALSE=0 #boolean - -lockfile=/var/lock/subsys/nginx -NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" - -#------------------------------------------------------------------------------ -# Simple Tests -#------------------------------------------------------------------------------ - -#test if nginx is a file and executable -test -x $DAEMON || exit 0 - -# Include nginx defaults if available -if [ -f /etc/default/nginx ] ; then - . /etc/default/nginx -fi - -#set exit condition -#set -e - -#------------------------------------------------------------------------------ -# Functions -#------------------------------------------------------------------------------ - -setFilePerms(){ - - if [ -f $PIDSPATH/$PIDFILE ]; then - chmod 400 $PIDSPATH/$PIDFILE - fi -} - -configtest() { - $DAEMON -t -c $NGINX_CONF_FILE -} - -getPSCount() { - return `pgrep -f $PS | wc -l` -} - -isRunning() { - if [ $1 ]; then - pidof_daemon $1 - PID=$? - - if [ $PID -gt 0 ]; then - return 1 - else - return 0 - fi - else - pidof_daemon - PID=$? - - if [ $PID -gt 0 ]; then - return 1 - else - return 0 - fi - fi -} - -#courtesy of php-fpm -wait_for_pid () { - try=0 - - while test $try -lt 35 ; do - - case "$1" in - 'created') - if [ -f "$2" ] ; then - try='' - break - fi - ;; - - 'removed') - if [ ! -f "$2" ] ; then - try='' - break - fi - ;; - esac - - #echo -n . - try=`expr $try + 1` - sleep 1 - done -} - -status(){ - isRunning - isAlive=$? - - if [ "${isAlive}" -eq $TRUE ]; then - echo "$PIDNAME found running with processes: `pidof $PS`" - else - echo "$PIDNAME is NOT running." - fi - - -} - -removePIDFile(){ - if [ $1 ]; then - if [ -f $1 ]; then - rm -f $1 - fi - else - #Do default removal - if [ -f $PIDSPATH/$PIDFILE ]; then - rm -f $PIDSPATH/$PIDFILE - fi - fi -} - -start() { - log_daemon_msg "Starting $DESCRIPTION" - - isRunning - isAlive=$? - - if [ "${isAlive}" -eq $TRUE ]; then - log_end_msg $SCRIPT_ERROR - else - start-stop-daemon --start --quiet --chuid $RUNAS --pidfile $PIDSPATH/$PIDFILE --exec $DAEMON \ - -- -c $NGINX_CONF_FILE - setFilePerms - log_end_msg $SCRIPT_OK - fi -} - -stop() { - log_daemon_msg "Stopping $DESCRIPTION" - - isRunning - isAlive=$? - if [ "${isAlive}" -eq $TRUE ]; then - start-stop-daemon --stop --quiet --pidfile $PIDSPATH/$PIDFILE - - wait_for_pid 'removed' $PIDSPATH/$PIDFILE - - if [ -n "$try" ] ; then - log_end_msg $SCRIPT_ERROR - else - removePIDFile - log_end_msg $SCRIPT_OK - fi - - else - log_end_msg $SCRIPT_ERROR - fi -} - -reload() { - configtest || return $? - - log_daemon_msg "Reloading (via HUP) $DESCRIPTION" - - isRunning - if [ $? -eq $TRUE ]; then - `killall -HUP $PS` #to be safe - - log_end_msg $SCRIPT_OK - else - log_end_msg $SCRIPT_ERROR - fi -} - -quietupgrade() { - log_daemon_msg "Peforming Quiet Upgrade $DESCRIPTION" - - isRunning - isAlive=$? - if [ "${isAlive}" -eq $TRUE ]; then - kill -USR2 `cat $PIDSPATH/$PIDFILE` - kill -WINCH `cat $PIDSPATH/$PIDFILE.oldbin` - - isRunning - isAlive=$? - if [ "${isAlive}" -eq $TRUE ]; then - kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` - wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin - removePIDFile $PIDSPATH/$PIDFILE.oldbin - - log_end_msg $SCRIPT_OK - else - log_end_msg $SCRIPT_ERROR - - log_daemon_msg "ERROR! Reverting back to original $DESCRIPTION" - - kill -HUP `cat $PIDSPATH/$PIDFILE` - kill -TERM `cat $PIDSPATH/$PIDFILE.oldbin` - kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin` - - wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin - removePIDFile $PIDSPATH/$PIDFILE.oldbin - - log_end_msg $SCRIPT_ok - fi - else - log_end_msg $SCRIPT_ERROR - fi -} - -terminate() { - log_daemon_msg "Force terminating (via KILL) $DESCRIPTION" - - PIDS=`pidof $PS` || true - - [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` - - for i in $PIDS; do - if [ "$i" = "$PIDS2" ]; then - kill $i - wait_for_pid 'removed' $PIDSPATH/$PIDFILE - removePIDFile - fi - done - - log_end_msg $SCRIPT_OK -} - -destroy() { - log_daemon_msg "Force terminating and may include self (via KILLALL) $DESCRIPTION" - killall $PS -q >> /dev/null 2>&1 - log_end_msg $SCRIPT_OK -} - -pidof_daemon() { - PIDS=`pidof $PS` || true - - [ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE` - - for i in $PIDS; do - if [ "$i" = "$PIDS2" ]; then - return 1 - fi - done - return 0 -} - -case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|force-reload) - stop - sleep 3 - start - ;; - reload) - $1 - ;; - status) - status - ;; - configtest) - $1 - ;; - quietupgrade) - $1 - ;; - terminate) - $1 - ;; - destroy) - $1 - ;; - *) - FULLPATH=/etc/init.d/$PS - echo "Usage: $FULLPATH {start|stop|restart|force-reload|status|configtest|quietupgrade|terminate|destroy}" - echo " The 'destroy' command should only be used as a last resort." - exit 1 - ;; -esac - -exit 0 diff --git a/app.conf b/app.conf deleted file mode 100644 index bd4a0bc7..00000000 --- a/app.conf +++ /dev/null @@ -1,26 +0,0 @@ -pcre_version=8.37 -nginx_version=1.9.7 -php_7_version=7.0.0 - -# operating environment for the current working directory -oneinstack_dir= - -# Nginx Apache and PHP-FPM process is run as $run_user(Default "www"), you can freely specify -run_user=www - -# set the default install path, you can freely specify -nginx_install_dir=/usr/local/nginx -php_install_dir=/usr/local/php - -# web directory, you can customize -wwwroot_dir=/data/www - -# nginx Generate a log storage directory, you can freely specify. -wwwlogs_dir=/data/logs - -data_dir=/home/nginx-php7 - -libiconv_version=1.14 -libmcrypt_version=2.5.8 -mcrypt_version=2.6.8 -mhash_version=0.9.9.9 \ No newline at end of file diff --git a/download.sh b/download.sh deleted file mode 100644 index 9fc77510..00000000 --- a/download.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -# Author: yeho -# BLOG: https://blog.linuxeye.com -# -# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ -# -# Project home page: -# http://oneinstack.com -# https://github.com/lj2007331/oneinstack - -Download_src() { - [ -s "${src_url##*/}" ] && echo "[${CMSG}${src_url##*/}${CEND}] found" || wget -c --no-check-certificate $src_url - if [ ! -e "${src_url##*/}" ];then - echo "${CFAILURE}${src_url##*/} download failed, Please contact the author! ${CEND}" - kill -9 $$ - fi -} diff --git a/nginx.conf b/nginx.conf index 15a2c5c3..535b1b4b 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,88 +1,122 @@ -user www www; +#user nobody; +#worker_processes 1; +#user www-data; worker_processes auto; +pid /run/nginx.pid; -error_log /data/logs/error_nginx.log crit; +#error_log logs/error.log; +#error_log logs/error.log notice; +#error_log logs/error.log info; + +#pid logs/nginx.pid; pid /var/run/nginx.pid; -worker_rlimit_nofile 51200; + events { - use epoll; - worker_connections 51200; - } + worker_connections 51200; +} + http { - include mime.types; - default_type application/octet-stream; - server_names_hash_bucket_size 128; - client_header_buffer_size 32k; - large_client_header_buffers 4 32k; - client_max_body_size 50m; - sendfile on; - tcp_nopush on; - keepalive_timeout 120; - server_tokens off; - tcp_nodelay on; - - fastcgi_connect_timeout 300; - fastcgi_send_timeout 300; - fastcgi_read_timeout 300; - fastcgi_buffer_size 64k; - fastcgi_buffers 4 64k; - fastcgi_busy_buffers_size 128k; - fastcgi_temp_file_write_size 128k; - - #Gzip Compression - gzip on; - gzip_buffers 16 8k; - gzip_comp_level 6; - gzip_http_version 1.1; - gzip_min_length 256; - gzip_proxied any; - gzip_vary on; - gzip_types - text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml - text/javascript application/javascript application/x-javascript - text/x-json application/json application/x-web-app-manifest+json - text/css text/plain text/x-component - font/opentype application/x-font-ttf application/vnd.ms-fontobject - image/x-icon; - gzip_disable "msie6"; - - #If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency. - open_file_cache max=1000 inactive=20s; - open_file_cache_valid 30s; - open_file_cache_min_uses 2; - open_file_cache_errors on; - -######################## default ############################ + include mime.types; + default_type application/octet-stream; + + #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + # '$status $body_bytes_sent "$http_referer" ' + # '"$http_user_agent" "$http_x_forwarded_for"'; + + #access_log logs/access.log main; + + sendfile on; + #tcp_nopush on; + + #keepalive_timeout 0; + keepalive_timeout 65; + + #gzip on; + server { - listen 80; - server_name _; - access_log /data/logs/access_nginx.log combined; - root /data/www; - index index.html index.htm index.php; - location /nginx_status { - stub_status on; - access_log off; - allow 127.0.0.1; - deny all; - } - location ~ .*\.(php|php5)?$ { - #fastcgi_pass remote_php_ip:9000; - fastcgi_pass unix:/dev/shm/php-cgi.sock; - fastcgi_index index.php; - include fastcgi.conf; + listen 80; + server_name localhost; + + #charset koi8-r; + + #access_log logs/host.access.log main; + + location / { + root /data/www; + index index.php index.html index.htm; } - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ { - expires 30d; - access_log off; + + #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 ~ .*\.(js|css)?$ { - expires 7d; - access_log off; + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + 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; } + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} } -########################## vhost ############################# - include vhost/*.conf; + + # another virtual host using mix of IP-, name-, and port-based configuration + # + #server { + # listen 8000; + # listen somename:8080; + # server_name somename alias another.alias; + + # location / { + # root html; + # index index.html index.htm; + # } + #} + + + # HTTPS server + # + #server { + # listen 443 ssl; + # server_name localhost; + + # ssl_certificate cert.pem; + # ssl_certificate_key cert.key; + + # ssl_session_cache shared:SSL:1m; + # ssl_session_timeout 5m; + + # ssl_ciphers HIGH:!aNULL:!MD5; + # ssl_prefer_server_ciphers on; + + # location / { + # root html; + # index index.html index.htm; + # } + #} + } + +#daemon off; diff --git a/nginx.sh b/nginx.sh deleted file mode 100644 index c2985b91..00000000 --- a/nginx.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash -# Author: yeho -# BLOG: https://blog.linuxeye.com -# -# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ -# -# Project home page: -# http://oneinstack.com -# https://github.com/lj2007331/oneinstack - -Install_Nginx() -{ -cd src -src_url=http://downloads.sourceforge.net/project/pcre/pcre/$pcre_version/pcre-$pcre_version.tar.gz && Download_src -src_url=http://nginx.org/download/nginx-$nginx_version.tar.gz && Download_src - -tar xzf pcre-$pcre_version.tar.gz -cd pcre-$pcre_version -./configure -make && make install -cd .. - -id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - -tar xzf nginx-$nginx_version.tar.gz -cd nginx-$nginx_version -# Modify Nginx version -#sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION "1.2"@' src/core/nginx.h -#sed -i 's@#define NGINX_VER.*NGINX_VERSION$@#define NGINX_VER "Linuxeye/" NGINX_VERSION@' src/core/nginx.h -#sed -i 's@Server: nginx@Server: linuxeye@' src/http/ngx_http_header_filter_module.c - -# close debug -sed -i 's@CFLAGS="$CFLAGS -g"@#CFLAGS="$CFLAGS -g"@' auto/cc/gcc - -if [ "$je_tc_malloc" = '1' ];then - malloc_module="--with-ld-opt='-ljemalloc'" -elif [ "$je_tc_malloc" = '2' ];then - malloc_module='--with-google_perftools_module' - mkdir /tmp/tcmalloc - chown -R ${run_user}.$run_user /tmp/tcmalloc -fi - -[ ! -d "$nginx_install_dir" ] && mkdir -p $nginx_install_dir -./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module $malloc_module -make && make install -if [ -e "$nginx_install_dir/conf/nginx.conf" ];then - cd .. - rm -rf nginx-$nginx_version - echo "${CSUCCESS}Nginx install successfully! ${CEND}" -else - rm -rf $nginx_install_dir - echo "${CFAILURE}Nginx install failed, Please Contact the author! ${CEND}" - kill -9 $$ -fi - -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$nginx_install_dir/sbin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $nginx_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$nginx_install_dir/sbin:\1@" /etc/profile -. /etc/profile - -#OS_command - - -echo "/bin/cp $data_dir/Nginx-init-Ubuntu /etc/init.d/nginx" | bash -echo "update-rc.d nginx defaults" | bash - -cd .. - -sed -i "s@/usr/local/nginx@$nginx_install_dir@g" /etc/init.d/nginx -mv $nginx_install_dir/conf/nginx.conf $nginx_install_dir/conf/nginx.conf_bk -cp $data_dir/nginx.conf $nginx_install_dir/conf/nginx.conf - -[ -z "`grep '/php-fpm_status' $nginx_install_dir/conf/nginx.conf`" ] && sed -i "s@index index.html index.php;@index index.html index.php;\n location ~ /php-fpm_status {\n #fastcgi_pass remote_php_ip:9000;\n fastcgi_pass unix:/dev/shm/php-cgi.sock;\n fastcgi_index index.php;\n include fastcgi.conf;\n allow 127.0.0.1;\n deny all;\n }@" $nginx_install_dir/conf/nginx.conf - -cat > $nginx_install_dir/conf/proxy.conf << EOF -proxy_connect_timeout 300s; -proxy_send_timeout 900; -proxy_read_timeout 900; -proxy_buffer_size 32k; -proxy_buffers 4 64k; -proxy_busy_buffers_size 128k; -proxy_redirect off; -proxy_hide_header Vary; -proxy_set_header Accept-Encoding ''; -proxy_set_header Referer \$http_referer; -proxy_set_header Cookie \$http_cookie; -proxy_set_header Host \$host; -proxy_set_header X-Real-IP \$remote_addr; -proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; -EOF - -mkdir $wwwlogs_dir - -sed -i "s@/data/www@$wwwroot_dir@" $nginx_install_dir/conf/nginx.conf -sed -i "s@/data/logs@$wwwlogs_dir@g" $nginx_install_dir/conf/nginx.conf -sed -i "s@^user www www@user $run_user $run_user@" $nginx_install_dir/conf/nginx.conf -[ "$je_tc_malloc" = '2' ] && sed -i 's@^pid\(.*\)@pid\1\ngoogle_perftools_profiles /tmp/tcmalloc;@' $nginx_install_dir/conf/nginx.conf - -# logrotate nginx log -cat > /etc/logrotate.d/nginx << EOF -$wwwlogs_dir/*nginx.log { -daily -rotate 5 -missingok -dateext -compress -notifempty -sharedscripts -postrotate - [ -e /var/run/nginx.pid ] && kill -USR1 \`cat /var/run/nginx.pid\` -endscript -} -EOF - -ldconfig -} diff --git a/php-7.sh b/php-7.sh deleted file mode 100644 index cfe92768..00000000 --- a/php-7.sh +++ /dev/null @@ -1,201 +0,0 @@ -#!/bin/bash -# Author: yeho -# BLOG: https://blog.linuxeye.com -# -# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+ -# -# Project home page: -# http://oneinstack.com -# https://github.com/lj2007331/oneinstack - -Install_PHP7() -{ - -#cd $data_dir/src -cd src -src_url=http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$libiconv_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/$libmcrypt_version/libmcrypt-$libmcrypt_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mhash/mhash/$mhash_version/mhash-$mhash_version.tar.gz && Download_src -src_url=http://downloads.sourceforge.net/project/mcrypt/MCrypt/$mcrypt_version/mcrypt-$mcrypt_version.tar.gz && Download_src -src_url=http://www.php.net/distributions/php-$php_7_version.tar.gz && Download_src - -tar xzf libiconv-$libiconv_version.tar.gz -cd libiconv-$libiconv_version -./configure --prefix=/usr/local -[ "$Ubuntu_version" == '13' ] && sed -i 's@_GL_WARN_ON_USE (gets@//_GL_WARN_ON_USE (gets@' srclib/stdio.h -[ "$Ubuntu_version" == '14' ] && sed -i 's@gets is a security@@' srclib/stdio.h -make && make install -cd .. -rm -rf libiconv-$libiconv_version - -tar xzf libmcrypt-$libmcrypt_version.tar.gz -cd libmcrypt-$libmcrypt_version -./configure -make && make install -ldconfig -cd libltdl -./configure --enable-ltdl-install -make && make install -cd ../../ -rm -rf libmcrypt-$libmcrypt_version - -tar xzf mhash-$mhash_version.tar.gz -cd mhash-$mhash_version -./configure -make && make install -cd .. -rm -rf mhash-$mhash_version - -echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf -ldconfig -OS_CentOS='ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config \n -if [ `getconf WORD_BIT` == 32 ] && [ `getconf LONG_BIT` == 64 ];then \n - ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 \n -else \n - ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1 \n -fi' - -tar xzf mcrypt-$mcrypt_version.tar.gz -cd mcrypt-$mcrypt_version -ldconfig -./configure -make && make install -cd .. -rm -rf mcrypt-$mcrypt_version - -id -u $run_user >/dev/null 2>&1 -[ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user - -tar xzf php-$php_7_version.tar.gz -cd php-$php_7_version -make clean -./buildconf -[ ! -d "$php_install_dir" ] && mkdir -p $php_install_dir - - ./configure --prefix=$php_install_dir --with-config-file-path=$php_install_dir/etc \ ---with-fpm-user=$run_user --with-fpm-group=$run_user --enable-fpm --disable-fileinfo \ ---with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ ---with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \ ---with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-exif \ ---enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-inline-optimization \ ---enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl \ ---with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-ftp \ ---with-gettext --enable-zip --enable-soap --disable-ipv6 --disable-debug - -make ZEND_EXTRA_LIBS='-liconv' -make install - -if [ -e "$php_install_dir/bin/phpize" ];then - echo "${CSUCCESS}PHP install successfully! ${CEND}" -else - rm -rf $php_install_dir - echo "${CFAILURE}PHP install failed, Please Contact the author! ${CEND}" - kill -9 $$ -fi - -[ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$php_install_dir/bin:\$PATH" >> /etc/profile -[ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $php_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$php_install_dir/bin:\1@" /etc/profile -. /etc/profile - -# wget -c http://pear.php.net/go-pear.phar -# $php_install_dir/bin/php go-pear.phar - -/bin/cp php.ini-production $php_install_dir/etc/php.ini - -sed -i "s@^memory_limit.*@memory_limit = ${Memory_limit}M@" $php_install_dir/etc/php.ini -sed -i 's@^output_buffering =@output_buffering = On\noutput_buffering =@' $php_install_dir/etc/php.ini -sed -i 's@^;cgi.fix_pathinfo.*@cgi.fix_pathinfo=0@' $php_install_dir/etc/php.ini -sed -i 's@^short_open_tag = Off@short_open_tag = On@' $php_install_dir/etc/php.ini -sed -i 's@^expose_php = On@expose_php = Off@' $php_install_dir/etc/php.ini -sed -i 's@^request_order.*@request_order = "CGP"@' $php_install_dir/etc/php.ini -sed -i 's@^;date.timezone.*@date.timezone = Asia/Shanghai@' $php_install_dir/etc/php.ini -sed -i 's@^post_max_size.*@post_max_size = 50M@' $php_install_dir/etc/php.ini -sed -i 's@^upload_max_filesize.*@upload_max_filesize = 50M@' $php_install_dir/etc/php.ini -sed -i 's@^;upload_tmp_dir.*@upload_tmp_dir = /tmp@' $php_install_dir/etc/php.ini -sed -i 's@^max_execution_time.*@max_execution_time = 600@' $php_install_dir/etc/php.ini -sed -i 's@^;realpath_cache_size.*@realpath_cache_size = 2M@' $php_install_dir/etc/php.ini -sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' $php_install_dir/etc/php.ini -sed -i 's@^session.cookie_httponly.*@session.cookie_httponly = 1@' $php_install_dir/etc/php.ini -sed -i 's@^mysqlnd.collect_memory_statistics.*@mysqlnd.collect_memory_statistics = On@' $php_install_dir/etc/php.ini -[ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' $php_install_dir/etc/php.ini - - -# php-fpm Init Script -/bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm -chmod +x /etc/init.d/php-fpm - -OS_Debian_Ubuntu='update-rc.d php-fpm defaults' - -cat > $php_install_dir/etc/php-fpm.conf < Date: Sun, 13 Dec 2015 13:05:50 +0800 Subject: [PATCH 06/67] update dockerfile for nginx --- Dockerfile | 10 +++++----- nginx.conf | 15 ++++++++------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3da6cfd6..14f5f431 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,7 +35,7 @@ RUN cd /home && \ wget -c http://nginx.org/download/nginx-1.9.9.tar.gz && \ tar -zxvf nginx-1.9.9.tar.gz && \ cd nginx-1.9.9 && \ -./configure --prefix=/usr/local/nginx --pid-path=/usr/local/nginx/run/nginx.pid --with-http_ssl_module --with-pcre --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module && \ +./configure --prefix=/usr/local/nginx --pid-path=/var/run/nginx.pid --with-http_ssl_module --with-pcre --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module && \ make && \ make install @@ -43,7 +43,7 @@ RUN cd /home && \ wget -O php-7.0.0.tar.gz http://am1.php.net/get/php-7.0.0.tar.gz/from/this/mirror && \ tar zvxf php-7.0.0.tar.gz && \ cd php-7.0.0 && \ -./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc --with-config-file-scan-dir=/usr/local/php7/etc/php.d --with-mcrypt=/usr/include --enable-mysqlnd --with-mysqli --with-pdo-mysql --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-gd --with-iconv --with-zlib --enable-xml --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache && \ +./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc --with-config-file-scan-dir=/usr/local/php7/etc/php.d --with-mcrypt=/usr/include --enable-mysqlnd --with-mysqli --with-pdo-mysql --enable-fpm --with-gd --with-iconv --with-zlib --enable-xml --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache && \ make && \ make install && \ cp php.ini-production /usr/local/php7/etc/php.ini && \ @@ -56,18 +56,18 @@ RUN cd /home && \ #Create web folder RUN mkdir -p /data/www VOLUME ["/data/www"] -ADD ./index.php /data/www/index.php +ADD index.php /data/www/index.php #RUN chown -Rf www-data.www-data /data/www #Update nginx config -#ADD ./nginx.conf /usr/local/nginx/conf/nginx.conf +ADD nginx.conf /usr/local/nginx/conf/nginx.conf #RUN sed -i -e"s/worker_processes 1/worker_processes 5/" /usr/local/nginx/conf/nginx.conf && \ #sed -i -e"s/keepalive_timeout\s*65/keepalive_timeout 2/" /usr/local/nginx/conf/nginx.conf && \ #sed -i -e"s/keepalive_timeout 2/keepalive_timeout 2;\n\tclient_max_body_size 100m/" /usr/local/nginx/conf/nginx.conf && \ #echo "daemon off;" >> /usr/local/nginx/conf/nginx.conf #Start -ADD ./start.sh /start.sh +ADD start.sh /start.sh RUN chmod +x /start.sh #Set port diff --git a/nginx.conf b/nginx.conf index 535b1b4b..28a35119 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,19 +1,19 @@ #user nobody; #worker_processes 1; -#user www-data; -worker_processes auto; -pid /run/nginx.pid; + +#user www-data; #modify +worker_processes auto; #modify #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; -pid /var/run/nginx.pid; +pid /var/run/nginx.pid; #modify events { - worker_connections 51200; + worker_connections 51200; #modify } @@ -27,11 +27,12 @@ http { #access_log logs/access.log main; + client_max_body_size 100m; #add sendfile on; #tcp_nopush on; #keepalive_timeout 0; - keepalive_timeout 65; + keepalive_timeout 120; #65; #gzip on; @@ -119,4 +120,4 @@ http { } -#daemon off; +daemon off; From 74bd65aabcda77fecf80136ed0478e8fced0c7e0 Mon Sep 17 00:00:00 2001 From: skiy Date: Mon, 14 Dec 2015 02:21:52 +0800 Subject: [PATCH 07/67] add rewrite --- nginx.conf | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/nginx.conf b/nginx.conf index 28a35119..3436f0ff 100644 --- a/nginx.conf +++ b/nginx.conf @@ -44,9 +44,16 @@ http { #access_log logs/host.access.log main; +# location / { +# root /data/www; +# index index.php index.html index.htm; +# } + + root /data/www; + index index.php index.html index.htm; + location / { - root /data/www; - index index.php index.html index.htm; + try_files $uri $uri/ /index.php?$args; } #error_page 404 /404.html; From ce1e76a61eb472dab9285f53f27eff0d0dc6a0ae Mon Sep 17 00:00:00 2001 From: skiy Date: Mon, 14 Dec 2015 23:58:35 +0800 Subject: [PATCH 08/67] update files --- Dockerfile | 158 +++++++++++++++++++++++++++++++++++++---------------- README.md | 39 +++++++++++++ nginx.conf | 9 ++- start.sh | 92 ++++++++++++++++++++++++++++++- 4 files changed, 246 insertions(+), 52 deletions(-) diff --git a/Dockerfile b/Dockerfile index 14f5f431..bd312907 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,75 +3,137 @@ MAINTAINER Skiychan #Install system library RUN yum -y install \ - gcc \ - gcc-c++ \ - autoconf \ - automake \ - libtool \ - make \ - cmake +gcc \ +gcc-c++ \ +autoconf \ +automake \ +libtool \ +make \ +cmake && \ +yum clean all #Install PHP library ## libmcrypt-devel DIY RUN rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm && \ - yum install -y wget \ - zlib \ - zlib-devel \ - openssl \ - openssl-devel \ - pcre-devel \ - libxml2 \ - libxml2-devel \ - libcurl \ - libcurl-devel \ - libjpeg-devel \ - libpng-devel \ - freetype-devel \ - libmcrypt-devel && \ - yum clean all +yum install -y wget \ +zlib \ +zlib-devel \ +openssl \ +openssl-devel \ +pcre-devel \ +libxml2 \ +libxml2-devel \ +libcurl \ +libcurl-devel \ +libjpeg-devel \ +libpng-devel \ +freetype-devel \ +libmcrypt-devel && \ +yum clean all -#Download & Make install nginx +#Add user +RUN groupadd --system www && \ +useradd --system --gid www www -M + +#Download nginx & php +RUN cd /home && \ +wget -c http://nginx.org/download/nginx-1.9.9.tar.gz && \ +wget -O php-7.0.0.tar.gz http://am1.php.net/get/php-7.0.0.tar.gz/from/this/mirror + +#Make install nginx RUN cd /home && \ - wget -c http://nginx.org/download/nginx-1.9.9.tar.gz && \ - tar -zxvf nginx-1.9.9.tar.gz && \ - cd nginx-1.9.9 && \ -./configure --prefix=/usr/local/nginx --pid-path=/var/run/nginx.pid --with-http_ssl_module --with-pcre --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module && \ - make && \ - make install +tar -zxvf nginx-1.9.9.tar.gz && \ +cd nginx-1.9.9 && \ +./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 RUN cd /home && \ - wget -O php-7.0.0.tar.gz http://am1.php.net/get/php-7.0.0.tar.gz/from/this/mirror && \ - tar zvxf php-7.0.0.tar.gz && \ - cd php-7.0.0 && \ -./configure --prefix=/usr/local/php7 --with-config-file-path=/usr/local/php7/etc --with-config-file-scan-dir=/usr/local/php7/etc/php.d --with-mcrypt=/usr/include --enable-mysqlnd --with-mysqli --with-pdo-mysql --enable-fpm --with-gd --with-iconv --with-zlib --enable-xml --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache && \ - make && \ - make install && \ - cp php.ini-production /usr/local/php7/etc/php.ini && \ - cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf && \ - cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf +tar zvxf php-7.0.0.tar.gz && \ +cd php-7.0.0 && \ +./configure --prefix=/usr/local/php7 \ +--with-config-file-path=/usr/local/php7/etc \ +--with-config-file-scan-dir=/usr/local/php7/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 \ +--disable-fileinfo \ +--disable-rpath \ +--disable-ipv6 \ +--disable-debug \ +--without-pear && \ +make && make install + +RUN cd /home/php-7.0.0/ && \ +cp php.ini-production /usr/local/php7/etc/php.ini && \ +cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf && \ +cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf && \ +cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm && \ +chmod +x /etc/init.d/php-fpm && \ +chkconfig --add php-fpm && \ +chkconfig php-fpm on #Remove zips -#RUN cd / && rm -rf /home/* +#RUN cd / && rm -rf /home/{php-7.0.0*} #Create web folder -RUN mkdir -p /data/www -VOLUME ["/data/www"] -ADD index.php /data/www/index.php +#RUN mkdir -p /data/www #RUN chown -Rf www-data.www-data /data/www +VOLUME ["/data/www", "/usr/local/nginx/conf/ssl", "/usr/local/nginx/conf/vhost"] +ADD index.php /data/www/index.php #Update nginx config ADD nginx.conf /usr/local/nginx/conf/nginx.conf -#RUN sed -i -e"s/worker_processes 1/worker_processes 5/" /usr/local/nginx/conf/nginx.conf && \ -#sed -i -e"s/keepalive_timeout\s*65/keepalive_timeout 2/" /usr/local/nginx/conf/nginx.conf && \ -#sed -i -e"s/keepalive_timeout 2/keepalive_timeout 2;\n\tclient_max_body_size 100m/" /usr/local/nginx/conf/nginx.conf && \ -#echo "daemon off;" >> /usr/local/nginx/conf/nginx.conf #Start ADD start.sh /start.sh RUN chmod +x /start.sh #Set port -EXPOSE 80 +EXPOSE 80 443 + +ENTRYPOINT ["/start.sh"] #Start web server -CMD ["/bin/bash", "/start.sh"] +#CMD ["/bin/bash", "/start.sh"] + +CMD ["nginx"] diff --git a/README.md b/README.md index 1e24f2c8..2c617f98 100644 --- a/README.md +++ b/README.md @@ -1 +1,40 @@ Nginx and PHP for Docker + +## Version +nginx: **1.9.9** +php: **7.0.0** + +## 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 +``` + +## Running +To simply run the container: +```sh +docker run --name nginx -p 8080:80 -d skiychan/nginx-php7 +``` +You can then browse to http://:8080 to view the default install files. + +## Volumes +If you want to link to your web site directory on the docker host to the container run: +```sh +docker run --name nginx -p 8080:80 -v /your_code_directory:/data/www -d skiychan/nginx-php7 +``` + +## Enabling SSL +```sh +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 +``` + +## Author +@autuor: Skiychan +@link: http://www.zzzzy.com \ No newline at end of file diff --git a/nginx.conf b/nginx.conf index 3436f0ff..6d224534 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,12 +1,13 @@ #user nobody; #worker_processes 1; -#user www-data; #modify +user www www; #modify worker_processes auto; #modify #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; +error_log /var/log/nginx_error.log crit; #add #pid logs/nginx.pid; pid /var/run/nginx.pid; #modify @@ -125,6 +126,10 @@ http { # } #} + #add + ##########################vhost##################################### + include vhost/*.conf; + } -daemon off; +#daemon off; diff --git a/start.sh b/start.sh index 72e6c2f7..b9940e13 100644 --- a/start.sh +++ b/start.sh @@ -1,2 +1,90 @@ -/usr/local/php7/sbin/php-fpm -/usr/local/nginx/sbin/nginx +#!/bin/sh +######################################################################### +# File Name: start.sh +# Author: Skiychan +# Email: dev@skiy.net +# Version: +# Created Time: 2015/12/13 +######################################################################### +PATH=/bin:/usr/local/nginx/sbin:$PATH +Nginx_Install_Dir=/usr/local/nginx +DATA_DIR=/data/www + +set -e + +if [ "${1:0:1}" = '-' ]; then + set -- nginx "$@" +fi + +chown -R www.www $DATA_DIR + +if [[ -n "$PROXY_WEB" ]]; then + + [ -f "${Nginx_Install_Dir}/conf/ssl" ] || mkdir -p $Nginx_Install_Dir/conf/ssl + [ -f "${Nginx_Install_Dir}/conf/vhost" ] || mkdir -p $Nginx_Install_Dir/conf/vhost + + if [ -z "$PROXY_DOMAIN" ]; then + echo >&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 ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM; + keepalive_timeout 70; + ssl_session_cache shared:SSL:10m; + ssl_session_timeout 10m; + + resolver 8.8.8.8; + location / { + google on; + google_scholar on; + google_language zh-CN; + google_robots_allow on; + } +} +EOF +fi + +#/usr/local/php7/sbin/php-fpm +#/usr/local/nginx/sbin/nginx +exec "$@" -g "daemon off;" From 5494a98587ba530defb8410673dcbfbbf0f91aa3 Mon Sep 17 00:00:00 2001 From: skiy Date: Tue, 15 Dec 2015 00:16:42 +0800 Subject: [PATCH 09/67] update README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2c617f98..ebfe903a 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ To simply run the container: ```sh docker run --name nginx -p 8080:80 -d skiychan/nginx-php7 ``` -You can then browse to http://:8080 to view the default install files. +You can then browse to http://\:8080 to view the default install files. ## Volumes If you want to link to your web site directory on the docker host to the container run: @@ -36,5 +36,5 @@ skiychan/nginx-php7 ``` ## Author -@autuor: Skiychan +@autuor: Skiychan @link: http://www.zzzzy.com \ No newline at end of file From 3c279bfe3d7199550175d6be1a2af2f85743cb7d Mon Sep 17 00:00:00 2001 From: skiy Date: Tue, 15 Dec 2015 13:33:28 +0800 Subject: [PATCH 10/67] update ssl --- Dockerfile | 198 ++++++++++++++++++++++++++++------------------------- README.md | 4 +- nginx | 84 +++++++++++++++++++++++ nginx.conf | 2 +- start.sh | 22 +++--- 5 files changed, 202 insertions(+), 108 deletions(-) create mode 100644 nginx diff --git a/Dockerfile b/Dockerfile index bd312907..334006bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,114 +3,122 @@ MAINTAINER Skiychan #Install system library RUN yum -y install \ -gcc \ -gcc-c++ \ -autoconf \ -automake \ -libtool \ -make \ -cmake && \ -yum clean all + gcc \ + gcc-c++ \ + autoconf \ + automake \ + libtool \ + make \ + cmake && \ + yum clean all #Install PHP library ## libmcrypt-devel DIY RUN rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm && \ -yum install -y wget \ -zlib \ -zlib-devel \ -openssl \ -openssl-devel \ -pcre-devel \ -libxml2 \ -libxml2-devel \ -libcurl \ -libcurl-devel \ -libjpeg-devel \ -libpng-devel \ -freetype-devel \ -libmcrypt-devel && \ -yum clean all + yum install -y wget \ + zlib \ + zlib-devel \ + openssl \ + openssl-devel \ + pcre-devel \ + libxml2 \ + libxml2-devel \ + libcurl \ + libcurl-devel \ + libjpeg-devel \ + libpng-devel \ + freetype-devel \ + libmcrypt-devel && \ + yum clean all #Add user -RUN groupadd --system www && \ -useradd --system --gid www www -M +RUN groupadd -r www && \ + useradd -M -s /sbin/nologin -r -g www www #Download nginx & php RUN cd /home && \ -wget -c http://nginx.org/download/nginx-1.9.9.tar.gz && \ -wget -O php-7.0.0.tar.gz http://am1.php.net/get/php-7.0.0.tar.gz/from/this/mirror + wget -c http://nginx.org/download/nginx-1.9.9.tar.gz && \ + wget -O php-7.0.0.tar.gz http://am1.php.net/get/php-7.0.0.tar.gz/from/this/mirror #Make install nginx RUN cd /home && \ -tar -zxvf nginx-1.9.9.tar.gz && \ -cd nginx-1.9.9 && \ -./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 + tar -zxvf nginx-1.9.9.tar.gz && \ + cd nginx-1.9.9 && \ + ./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 \ + --lock-path=/var/lock/subsys/nginx \ + --with-pcre \ + --with-http_ssl_module \ + --without-mail_pop3_module \ + --without-mail_imap_module \ + --with-http_gzip_static_module && \ + make && make install +#Add nginx.service +ADD nginx /etc/init.d/nginx +RUN chmod +x /etc/init.d/nginx && \ + chkconfig --add nginx && \ + chkconfig nginx on + +#Make install php RUN cd /home && \ -tar zvxf php-7.0.0.tar.gz && \ -cd php-7.0.0 && \ -./configure --prefix=/usr/local/php7 \ ---with-config-file-path=/usr/local/php7/etc \ ---with-config-file-scan-dir=/usr/local/php7/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 \ ---disable-fileinfo \ ---disable-rpath \ ---disable-ipv6 \ ---disable-debug \ ---without-pear && \ -make && make install + tar zvxf php-7.0.0.tar.gz && \ + cd php-7.0.0 && \ + ./configure --prefix=/usr/local/php7 \ + --with-config-file-path=/usr/local/php7/etc \ + --with-config-file-scan-dir=/usr/local/php7/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 \ + --disable-fileinfo \ + --disable-rpath \ + --disable-ipv6 \ + --disable-debug \ + --without-pear && \ + make && make install RUN cd /home/php-7.0.0/ && \ -cp php.ini-production /usr/local/php7/etc/php.ini && \ -cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf && \ -cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf && \ -cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm && \ -chmod +x /etc/init.d/php-fpm && \ -chkconfig --add php-fpm && \ -chkconfig php-fpm on + cp php.ini-production /usr/local/php7/etc/php.ini && \ + cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf && \ + cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf && \ + cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm && \ + chmod +x /etc/init.d/php-fpm && \ + chkconfig --add php-fpm && \ + chkconfig php-fpm on #Remove zips #RUN cd / && rm -rf /home/{php-7.0.0*} @@ -131,9 +139,9 @@ RUN chmod +x /start.sh #Set port EXPOSE 80 443 -ENTRYPOINT ["/start.sh"] +#ENTRYPOINT ["/start.sh"] #Start web server -#CMD ["/bin/bash", "/start.sh"] +CMD ["/bin/bash", "/start.sh"] -CMD ["nginx"] +#CMD ["nginx"] diff --git a/README.md b/README.md index ebfe903a..bee4c9b0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Nginx and PHP for Docker ## Version -nginx: **1.9.9** +nginx: **1.9.9** php: **7.0.0** ## Installation @@ -37,4 +37,4 @@ skiychan/nginx-php7 ## Author @autuor: Skiychan -@link: http://www.zzzzy.com \ No newline at end of file +@link: http://www.zzzzy.com diff --git a/nginx b/nginx new file mode 100644 index 00000000..ea82ec9f --- /dev/null +++ b/nginx @@ -0,0 +1,84 @@ +#!/bin/bash +# nginx Startup script for the Nginx HTTP Server +# this script create it by ivan at 2010.12.29. +# +# chkconfig: - 85 15 +# description: Nginx is a high-performance web and proxy server. +# It has a lot of features, but it's not for everyone. +# processname: nginx +# pidfile: /var/run/nginx.pid +# config: /etc/nginx.conf + +nginxd=/usr/local/nginx/sbin/nginx +nginx_config=/usr/local/nginx/conf/nginx.conf +nginx_pid=/var/run/nginx.pid + +RETVAL=0 +prog="nginx" + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +# Check that networking is up. +[ ${NETWORKING} = "no" ] && exit 0 +[ -x $nginxd ] || exit 0 + +# Start nginx daemons functions. +start(){ + + if [ -e $nginx_pid ]; then + echo "nginx already running..." + exit 1 + fi + echo -n $"Starting $prog:" + daemon $nginxd -c ${nginx_config} + RETVAL=$? + echo + [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx + return $RETVAL +} + +# Stop nginx daemons functions. +stop(){ + echo -n $"Stopping $prog:" + killproc $nginxd + RETVAL=$? + echo + [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx $nginx_pid +} + +#reload nginx service functions. +reload(){ + echo -n $"Reloading $proc:" + killproc $nginxd -HUP + RETVAL=$? + echo +} +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + reload) + reload + ;; + restart) + stop + start + ;; + status) + status $prog + RETVAL=$? + ;; + *) + echo $"Usage: $prog {start|stop|restart|reload|status|help}" + exit 1 +esac + +exit $RETVAL diff --git a/nginx.conf b/nginx.conf index 6d224534..6966b7ae 100644 --- a/nginx.conf +++ b/nginx.conf @@ -132,4 +132,4 @@ http { } -#daemon off; +daemon off; diff --git a/start.sh b/start.sh index b9940e13..2a3717fa 100644 --- a/start.sh +++ b/start.sh @@ -16,6 +16,12 @@ if [ "${1:0:1}" = '-' ]; then set -- nginx "$@" fi +if [[ -e /var/lock ]]; then + rm -rf /var/lock + [ -f /var/lock/subsys ] || mkdir -p /var/lock/subsys + #touch /var/lock/subsys/nginx +fi + chown -R www.www $DATA_DIR if [[ -n "$PROXY_WEB" ]]; then @@ -60,7 +66,7 @@ server { return 301 https://$PROXY_DOMAIN\$request_uri; } - server { +server { listen 443 ssl; server_name $PROXY_DOMAIN; @@ -73,18 +79,14 @@ server { keepalive_timeout 70; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; - - resolver 8.8.8.8; - location / { - google on; - google_scholar on; - google_language zh-CN; - google_robots_allow on; - } } EOF fi #/usr/local/php7/sbin/php-fpm #/usr/local/nginx/sbin/nginx -exec "$@" -g "daemon off;" +#exec "$@" -g "daemon off;" + +/etc/init.d/php-fpm start + +/usr/local/nginx/sbin/nginx From 421f1b98268f5dd530ca8c6925ab1d17410c6d24 Mon Sep 17 00:00:00 2001 From: skiy Date: Tue, 15 Dec 2015 17:44:23 +0800 Subject: [PATCH 11/67] update --- Dockerfile | 7 +- init.d/functions | 595 ++++++++++++++++++++++++++++++++++++++++++ init.d/network | 249 ++++++++++++++++++ nginx => init.d/nginx | 2 +- start.sh | 7 +- 5 files changed, 855 insertions(+), 5 deletions(-) create mode 100644 init.d/functions create mode 100644 init.d/network rename nginx => init.d/nginx (97%) diff --git a/Dockerfile b/Dockerfile index 334006bd..b88010e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,6 +31,12 @@ RUN rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch libmcrypt-devel && \ yum clean all +#Add init.d files +ADD init.d/* /etc/init.d/ +#ADD functions /etc/init.d/functions +#ADD network /etc/init.d/network +#ADD nginx /etc/init.d/nginx + #Add user RUN groupadd -r www && \ useradd -M -s /sbin/nologin -r -g www www @@ -58,7 +64,6 @@ RUN cd /home && \ make && make install #Add nginx.service -ADD nginx /etc/init.d/nginx RUN chmod +x /etc/init.d/nginx && \ chkconfig --add nginx && \ chkconfig nginx on diff --git a/init.d/functions b/init.d/functions new file mode 100644 index 00000000..f69821f0 --- /dev/null +++ b/init.d/functions @@ -0,0 +1,595 @@ +# -*-Shell-script-*- +# +# functions This file contains functions to be used by most or all +# shell scripts in the /etc/init.d directory. +# + +TEXTDOMAIN=initscripts + +# Make sure umask is sane +umask 022 + +# Set up a default search path. +PATH="/sbin:/usr/sbin:/bin:/usr/bin" +export PATH + +if [ $PPID -ne 1 -a -z "$SYSTEMCTL_SKIP_REDIRECT" ] && \ + ( /bin/mountpoint -q /cgroup/systemd || /bin/mountpoint -q /sys/fs/cgroup/systemd ) ; then + case "$0" in + /etc/init.d/*|/etc/rc.d/init.d/*) + _use_systemctl=1 + ;; + esac +fi + +systemctl_redirect () { + local s + local prog=${1##*/} + local command=$2 + local options="" + + case "$command" in + start) + s=$"Starting $prog (via systemctl): " + ;; + stop) + s=$"Stopping $prog (via systemctl): " + ;; + reload|try-reload) + s=$"Reloading $prog configuration (via systemctl): " + ;; + restart|try-restart|condrestart) + s=$"Restarting $prog (via systemctl): " + ;; + esac + + if [ -n "$SYSTEMCTL_IGNORE_DEPENDENCIES" ] ; then + options="--ignore-dependencies" + fi + + action "$s" /bin/systemctl $options $command "$prog.service" +} + +# Get a sane screen width +[ -z "${COLUMNS:-}" ] && COLUMNS=80 + +if [ -z "${CONSOLETYPE:-}" ]; then + if [ -c "/dev/stderr" -a -r "/dev/stderr" ]; then + CONSOLETYPE="$(/sbin/consoletype < /dev/stderr 2>/dev/null)" + else + CONSOLETYPE="serial" + fi +fi + +if [ -z "${NOLOCALE:-}" ] && [ -z "${LANGSH_SOURCED:-}" ] && [ -f /etc/sysconfig/i18n -o -f /etc/locale.conf ] ; then + . /etc/profile.d/lang.sh 2>/dev/null + # avoid propagating LANGSH_SOURCED any further + unset LANGSH_SOURCED +fi + +# Read in our configuration +if [ -z "${BOOTUP:-}" ]; then + if [ -f /etc/sysconfig/init ]; then + . /etc/sysconfig/init + else + # This all seem confusing? Look in /etc/sysconfig/init, + # or in /usr/share/doc/initscripts-*/sysconfig.txt + BOOTUP=color + RES_COL=60 + MOVE_TO_COL="echo -en \\033[${RES_COL}G" + SETCOLOR_SUCCESS="echo -en \\033[1;32m" + SETCOLOR_FAILURE="echo -en \\033[1;31m" + SETCOLOR_WARNING="echo -en \\033[1;33m" + SETCOLOR_NORMAL="echo -en \\033[0;39m" + LOGLEVEL=1 + fi + if [ "$CONSOLETYPE" = "serial" ]; then + BOOTUP=serial + MOVE_TO_COL= + SETCOLOR_SUCCESS= + SETCOLOR_FAILURE= + SETCOLOR_WARNING= + SETCOLOR_NORMAL= + fi +fi + +# Check if any of $pid (could be plural) are running +checkpid() { + local i + + for i in $* ; do + [ -d "/proc/$i" ] && return 0 + done + return 1 +} + +# __proc_pids {program} [pidfile] +# Set $pid to pids from /var/run* for {program}. $pid should be declared +# local in the caller. +# Returns LSB exit code for the 'status' action. +__pids_var_run() { + local base=${1##*/} + local pid_file=${2:-/var/run/$base.pid} + + pid= + if [ -f "$pid_file" ] ; then + local line p + + [ ! -r "$pid_file" ] && return 4 # "user had insufficient privilege" + while : ; do + read line + [ -z "$line" ] && break + for p in $line ; do + [ -z "${p//[0-9]/}" ] && [ -d "/proc/$p" ] && pid="$pid $p" + done + done < "$pid_file" + + if [ -n "$pid" ]; then + return 0 + fi + return 1 # "Program is dead and /var/run pid file exists" + fi + return 3 # "Program is not running" +} + +# Output PIDs of matching processes, found using pidof +__pids_pidof() { + pidof -c -m -o $$ -o $PPID -o %PPID -x "$1" || \ + pidof -c -m -o $$ -o $PPID -o %PPID -x "${1##*/}" +} + + +# A function to start a program. +daemon() { + # Test syntax. + local gotbase= force= nicelevel corelimit + local pid base= user= nice= bg= pid_file= + local cgroup= + nicelevel=0 + while [ "$1" != "${1##[-+]}" ]; do + case $1 in + '') echo $"$0: Usage: daemon [+/-nicelevel] {program}" + return 1;; + --check) + base=$2 + gotbase="yes" + shift 2 + ;; + --check=?*) + base=${1#--check=} + gotbase="yes" + shift + ;; + --user) + user=$2 + shift 2 + ;; + --user=?*) + user=${1#--user=} + shift + ;; + --pidfile) + pid_file=$2 + shift 2 + ;; + --pidfile=?*) + pid_file=${1#--pidfile=} + shift + ;; + --force) + force="force" + shift + ;; + [-+][0-9]*) + nice="nice -n $1" + shift + ;; + *) echo $"$0: Usage: daemon [+/-nicelevel] {program}" + return 1;; + esac + done + + # Save basename. + [ -z "$gotbase" ] && base=${1##*/} + + # See if it's already running. Look *only* at the pid file. + __pids_var_run "$base" "$pid_file" + + [ -n "$pid" -a -z "$force" ] && return + + # make sure it doesn't core dump anywhere unless requested + corelimit="ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0}" + + # if they set NICELEVEL in /etc/sysconfig/foo, honor it + [ -n "${NICELEVEL:-}" ] && nice="nice -n $NICELEVEL" + + # if they set CGROUP_DAEMON in /etc/sysconfig/foo, honor it + if [ -n "${CGROUP_DAEMON}" ]; then + if [ ! -x /bin/cgexec ]; then + echo -n "Cgroups not installed"; warning + echo + else + cgroup="/bin/cgexec"; + for i in $CGROUP_DAEMON; do + cgroup="$cgroup -g $i"; + done + fi + fi + + # Echo daemon + [ "${BOOTUP:-}" = "verbose" -a -z "${LSB:-}" ] && echo -n " $base" + + # And start it up. + if [ -z "$user" ]; then + $cgroup $nice /bin/bash -c "$corelimit >/dev/null 2>&1 ; $*" + else + $cgroup $nice runuser -s /bin/bash $user -c "$corelimit >/dev/null 2>&1 ; $*" + fi + + [ "$?" -eq 0 ] && success $"$base startup" || failure $"$base startup" +} + +# A function to stop a program. +killproc() { + local RC killlevel= base pid pid_file= delay try + + RC=0; delay=3; try=0 + # Test syntax. + if [ "$#" -eq 0 ]; then + echo $"Usage: killproc [-p pidfile] [ -d delay] {program} [-signal]" + return 1 + fi + if [ "$1" = "-p" ]; then + pid_file=$2 + shift 2 + fi + if [ "$1" = "-d" ]; then + delay=$(echo $2 | awk -v RS=' ' -v IGNORECASE=1 '{if($1!~/^[0-9.]+[smhd]?$/) exit 1;d=$1~/s$|^[0-9.]*$/?1:$1~/m$/?60:$1~/h$/?60*60:$1~/d$/?24*60*60:-1; +if(d==-1) exit 1;delay+=d*$1} END {printf("%d",delay+0.5)}') + if [ "$?" -eq 1 ]; then + echo $"Usage: killproc [-p pidfile] [ -d delay] {program} [-signal]" + return 1 + fi + shift 2 + fi + + + # check for second arg to be kill level + [ -n "${2:-}" ] && killlevel=$2 + + # Save basename. + base=${1##*/} + + # Find pid. + __pids_var_run "$1" "$pid_file" + RC=$? + if [ -z "$pid" ]; then + if [ -z "$pid_file" ]; then + pid="$(__pids_pidof "$1")" + else + [ "$RC" = "4" ] && { failure $"$base shutdown" ; return $RC ;} + fi + fi + + # Kill it. + if [ -n "$pid" ] ; then + [ "$BOOTUP" = "verbose" -a -z "${LSB:-}" ] && echo -n "$base " + if [ -z "$killlevel" ] ; then + if checkpid $pid 2>&1; then + # TERM first, then KILL if not dead + kill -TERM $pid >/dev/null 2>&1 + usleep 50000 + if checkpid $pid ; then + try=0 + while [ $try -lt $delay ] ; do + checkpid $pid || break + sleep 1 + let try+=1 + done + if checkpid $pid ; then + kill -KILL $pid >/dev/null 2>&1 + usleep 50000 + fi + fi + fi + checkpid $pid + RC=$? + [ "$RC" -eq 0 ] && failure $"$base shutdown" || success $"$base shutdown" + RC=$((! $RC)) + # use specified level only + else + if checkpid $pid; then + kill $killlevel $pid >/dev/null 2>&1 + RC=$? + [ "$RC" -eq 0 ] && success $"$base $killlevel" || failure $"$base $killlevel" + elif [ -n "${LSB:-}" ]; then + RC=7 # Program is not running + fi + fi + else + if [ -n "${LSB:-}" -a -n "$killlevel" ]; then + RC=7 # Program is not running + else + failure $"$base shutdown" + RC=0 + fi + fi + + # Remove pid file if any. + if [ -z "$killlevel" ]; then + rm -f "${pid_file:-/var/run/$base.pid}" + fi + return $RC +} + +# A function to find the pid of a program. Looks *only* at the pidfile +pidfileofproc() { + local pid + + # Test syntax. + if [ "$#" = 0 ] ; then + echo $"Usage: pidfileofproc {program}" + return 1 + fi + + __pids_var_run "$1" + [ -n "$pid" ] && echo $pid + return 0 +} + +# A function to find the pid of a program. +pidofproc() { + local RC pid pid_file= + + # Test syntax. + if [ "$#" = 0 ]; then + echo $"Usage: pidofproc [-p pidfile] {program}" + return 1 + fi + if [ "$1" = "-p" ]; then + pid_file=$2 + shift 2 + fi + fail_code=3 # "Program is not running" + + # First try "/var/run/*.pid" files + __pids_var_run "$1" "$pid_file" + RC=$? + if [ -n "$pid" ]; then + echo $pid + return 0 + fi + + [ -n "$pid_file" ] && return $RC + __pids_pidof "$1" || return $RC +} + +status() { + local base pid lock_file= pid_file= + + # Test syntax. + if [ "$#" = 0 ] ; then + echo $"Usage: status [-p pidfile] {program}" + return 1 + fi + if [ "$1" = "-p" ]; then + pid_file=$2 + shift 2 + fi + if [ "$1" = "-l" ]; then + lock_file=$2 + shift 2 + fi + base=${1##*/} + + if [ "$_use_systemctl" = "1" ]; then + systemctl status ${0##*/}.service + return $? + fi + + # First try "pidof" + __pids_var_run "$1" "$pid_file" + RC=$? + if [ -z "$pid_file" -a -z "$pid" ]; then + pid="$(__pids_pidof "$1")" + fi + if [ -n "$pid" ]; then + echo $"${base} (pid $pid) is running..." + return 0 + fi + + case "$RC" in + 0) + echo $"${base} (pid $pid) is running..." + return 0 + ;; + 1) + echo $"${base} dead but pid file exists" + return 1 + ;; + 4) + echo $"${base} status unknown due to insufficient privileges." + return 4 + ;; + esac + if [ -z "${lock_file}" ]; then + lock_file=${base} + fi + # See if /var/lock/subsys/${lock_file} exists + if [ -f /var/lock/subsys/${lock_file} ]; then + echo $"${base} dead but subsys locked" + return 2 + fi + echo $"${base} is stopped" + return 3 +} + +echo_success() { + [ "$BOOTUP" = "color" ] && $MOVE_TO_COL + echo -n "[" + [ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS + echo -n $" OK " + [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL + echo -n "]" + echo -ne "\r" + return 0 +} + +echo_failure() { + [ "$BOOTUP" = "color" ] && $MOVE_TO_COL + echo -n "[" + [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE + echo -n $"FAILED" + [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL + echo -n "]" + echo -ne "\r" + return 1 +} + +echo_passed() { + [ "$BOOTUP" = "color" ] && $MOVE_TO_COL + echo -n "[" + [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING + echo -n $"PASSED" + [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL + echo -n "]" + echo -ne "\r" + return 1 +} + +echo_warning() { + [ "$BOOTUP" = "color" ] && $MOVE_TO_COL + echo -n "[" + [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING + echo -n $"WARNING" + [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL + echo -n "]" + echo -ne "\r" + return 1 +} + +# Inform the graphical boot of our current state +update_boot_stage() { + if [ -x /bin/plymouth ]; then + /bin/plymouth --update="$1" + fi + return 0 +} + +# Log that something succeeded +success() { + [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_success + return 0 +} + +# Log that something failed +failure() { + local rc=$? + [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_failure + [ -x /bin/plymouth ] && /bin/plymouth --details + return $rc +} + +# Log that something passed, but may have had errors. Useful for fsck +passed() { + local rc=$? + [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_passed + return $rc +} + +# Log a warning +warning() { + local rc=$? + [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_warning + return $rc +} + +# Run some action. Log its output. +action() { + local STRING rc + + STRING=$1 + echo -n "$STRING " + shift + "$@" && success $"$STRING" || failure $"$STRING" + rc=$? + echo + return $rc +} + +# returns OK if $1 contains $2 +strstr() { + [ "${1#*$2*}" = "$1" ] && return 1 + return 0 +} + +# Check whether file $1 is a backup or rpm-generated file and should be ignored +is_ignored_file() { + case "$1" in + *~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave) + return 0 + ;; + esac + return 1 +} + +# Evaluate shvar-style booleans +is_true() { + case "$1" in + [tT] | [yY] | [yY][eE][sS] | [tT][rR][uU][eE]) + return 0 + ;; + esac + return 1 +} + +# Evaluate shvar-style booleans +is_false() { + case "$1" in + [fF] | [nN] | [nN][oO] | [fF][aA][lL][sS][eE]) + return 0 + ;; + esac + return 1 +} + +# Apply sysctl settings, including files in /etc/sysctl.d +apply_sysctl() { + if [ -x /lib/systemd/systemd-sysctl ]; then + /lib/systemd/systemd-sysctl + else + for file in /usr/lib/sysctl.d/*.conf ; do + is_ignored_file "$file" && continue + [ -f /run/sysctl.d/${file##*/} ] && continue + [ -f /etc/sysctl.d/${file##*/} ] && continue + test -f "$file" && sysctl -e -p "$file" >/dev/null 2>&1 + done + for file in /run/sysctl.d/*.conf ; do + is_ignored_file "$file" && continue + [ -f /etc/sysctl.d/${file##*/} ] && continue + test -f "$file" && sysctl -e -p "$file" >/dev/null 2>&1 + done + for file in /etc/sysctl.d/*.conf ; do + is_ignored_file "$file" && continue + test -f "$file" && sysctl -e -p "$file" >/dev/null 2>&1 + done + sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1 + fi +} + +# A sed expression to filter out the files that is_ignored_file recognizes +__sed_discard_ignored_files='/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d' + +if [ "$_use_systemctl" = "1" ]; then + if [ "x$1" = xstart -o \ + "x$1" = xstop -o \ + "x$1" = xrestart -o \ + "x$1" = xreload -o \ + "x$1" = xtry-restart -o \ + "x$1" = xforce-reload -o \ + "x$1" = xcondrestart ] ; then + + systemctl_redirect $0 $1 + exit $? + fi +fi \ No newline at end of file diff --git a/init.d/network b/init.d/network new file mode 100644 index 00000000..e287c7b2 --- /dev/null +++ b/init.d/network @@ -0,0 +1,249 @@ +#! /bin/bash +# +# network Bring up/down networking +# +# chkconfig: 2345 10 90 +# description: Activates/Deactivates all network interfaces configured to \ +# start at boot time. +# +### BEGIN INIT INFO +# Provides: $network +# Should-Start: iptables ip6tables NetworkManager-wait-online NetworkManager +# Short-Description: Bring up/down networking +# Description: Bring up/down networking +### END INIT INFO + +# Source function library. +. /etc/init.d/functions + +if [ ! -f /etc/sysconfig/network ]; then + exit 6 +fi + +. /etc/sysconfig/network + +if [ -f /etc/sysconfig/pcmcia ]; then + . /etc/sysconfig/pcmcia +fi + + +# Check that networking is up. +[ "${NETWORKING}" = "no" ] && exit 6 + +# if the ip configuration utility isn't around we can't function. +[ -x /sbin/ip ] || exit 1 + + +CWD=$(pwd) +cd /etc/sysconfig/network-scripts + +. ./network-functions + +# find all the interfaces besides loopback. +# ignore aliases, alternative configurations, and editor backup files +interfaces=$(ls ifcfg-* | \ + LC_ALL=C sed -e "$__sed_discard_ignored_files" \ + -e '/\(ifcfg-lo$\|:\|ifcfg-.*-range\)/d' \ + -e '{ s/^ifcfg-//g;s/[0-9]/ &/}' | \ + LC_ALL=C sort -k 1,1 -k 2n | \ + LC_ALL=C sed 's/ //') +rc=0 + +# See how we were called. +case "$1" in + start) + [ "$EUID" != "0" ] && exit 4 + rc=0 + # IPv6 hook (pre IPv4 start) + if [ -x /etc/sysconfig/network-scripts/init.ipv6-global ]; then + /etc/sysconfig/network-scripts/init.ipv6-global start pre + fi + + apply_sysctl + + # bring up loopback interface + action $"Bringing up loopback interface: " ./ifup ifcfg-lo + + case "$VLAN" in + yes) + if [ ! -d /proc/net/vlan ] && ! modprobe 8021q >/dev/null 2>&1 ; then + net_log $"No 802.1Q VLAN support available in kernel." + fi + ;; + esac + + vlaninterfaces="" + vpninterfaces="" + xdslinterfaces="" + bridgeinterfaces="" + + # bring up all other interfaces configured to come up at boot time + for i in $interfaces; do + unset DEVICE TYPE SLAVE + eval $(LANG=C grep -F "DEVICE=" ifcfg-$i) + eval $(LANG=C grep -F "TYPE=" ifcfg-$i) + eval $(LANG=C grep -F "SLAVE=" ifcfg-$i) + eval $(LANG=C grep -F "NM_CONTROLLED=" ifcfg-$i) + + if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi + + if [ "$SLAVE" = "yes" ] && ( ! is_nm_running || is_false $NM_CONTROLLED ) ; then + continue + fi + + if [ "${DEVICE##cipcb}" != "$DEVICE" ] ; then + vpninterfaces="$vpninterfaces $i" + continue + fi + if [ "$TYPE" = "xDSL" ]; then + xdslinterfaces="$xdslinterfaces $i" + continue + fi + + if [ "$TYPE" = "Bridge" ]; then + bridgeinterfaces="$bridgeinterfaces $i" + continue + fi + if [ "$TYPE" = "IPSEC" ]; then + vpninterfaces="$vpninterfaces $i" + continue + fi + + if [ "${DEVICE%%.*}" != "$DEVICE" -o "${DEVICE##vlan}" != "$DEVICE" ] ; then + vlaninterfaces="$vlaninterfaces $i" + continue + fi + + if LANG=C grep -EL "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i > /dev/null ; then + # this loads the module, to preserve ordering + is_available $i + continue + fi + action $"Bringing up interface $i: " ./ifup $i boot + [ $? -ne 0 ] && rc=1 + done + + # Bring up xDSL and VPN interfaces + for i in $vlaninterfaces $bridgeinterfaces $xdslinterfaces $vpninterfaces ; do + if ! LANG=C grep -EL "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i >/dev/null 2>&1 ; then + action $"Bringing up interface $i: " ./ifup $i boot + [ $? -ne 0 ] && rc=1 + fi + done + + # Add non interface-specific static-routes. + if [ -f /etc/sysconfig/static-routes ]; then + if [ -x /sbin/route ]; then + grep "^any" /etc/sysconfig/static-routes | while read ignore args ; do + /sbin/route add -$args + done + else + net_log $"Legacy static-route support not available: /sbin/route not found" + fi + fi + + # IPv6 hook (post IPv4 start) + if [ -x /etc/sysconfig/network-scripts/init.ipv6-global ]; then + /etc/sysconfig/network-scripts/init.ipv6-global start post + fi + # Run this again to catch any interface-specific actions + apply_sysctl + + touch /var/lock/subsys/network + + [ -n "${NETWORKDELAY}" ] && /bin/sleep ${NETWORKDELAY} + ;; + stop) + [ "$EUID" != "0" ] && exit 4 + # Don't shut the network down if root is on NFS or a network + # block device. + rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/" && $3 != "rootfs") { print $3; }}' /proc/mounts) + rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab) + + if [[ "$rootfs" == nfs* || "$rootopts" =~ _r?netdev ]] ; then + exit 1 + fi + + systemctl show --property=RequiredBy -- -.mount | grep -q 'remote-fs.target' && exit 1 + + vlaninterfaces="" + vpninterfaces="" + xdslinterfaces="" + bridgeinterfaces="" + remaining="" + rc=0 + + # get list of bonding, vpn, and xdsl interfaces + for i in $interfaces; do + unset DEVICE TYPE + eval $(LANG=C grep -F "DEVICE=" ifcfg-$i) + eval $(LANG=C grep -F "TYPE=" ifcfg-$i) + + if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi + + if [ "${DEVICE##cipcb}" != "$DEVICE" ] ; then + vpninterfaces="$vpninterfaces $i" + continue + fi + if [ "$TYPE" = "IPSEC" ]; then + vpninterfaces="$vpninterfaces $i" + continue + fi + if [ "$TYPE" = "Bridge" ]; then + bridgeinterfaces="$bridgeinterfaces $i" + continue + fi + if [ "$TYPE" = "xDSL" ]; then + xdslinterfaces="$xdslinterfaces $i" + continue + fi + + if [ "${DEVICE%%.*}" != "$DEVICE" -o "${DEVICE##vlan}" != "$DEVICE" ] ; then + vlaninterfaces="$vlaninterfaces $i" + continue + fi + remaining="$remaining $i" + done + + for i in $vpninterfaces $xdslinterfaces $bridgeinterfaces $vlaninterfaces $remaining; do + unset DEVICE TYPE + (. ./ifcfg-$i + if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi + + if ! check_device_down $DEVICE; then + action $"Shutting down interface $i: " ./ifdown $i boot + [ $? -ne 0 ] && rc=1 + fi + ) + done + + action $"Shutting down loopback interface: " ./ifdown ifcfg-lo + + sysctl -w net.ipv4.ip_forward=0 > /dev/null 2>&1 + + # IPv6 hook (post IPv4 stop) + if [ -x /etc/sysconfig/network-scripts/init.ipv6-global ]; then + /etc/sysconfig/network-scripts/init.ipv6-global stop post + fi + + rm -f /var/lock/subsys/network + ;; + status) + echo $"Configured devices:" + echo lo $interfaces + + echo $"Currently active devices:" + echo $(/sbin/ip -o link show up | awk -F ": " '{ print $2 }') + ;; + restart|reload|force-reload) + cd "$CWD" + $0 stop + $0 start + rc=$? + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}" + exit 2 +esac + +exit $rc diff --git a/nginx b/init.d/nginx similarity index 97% rename from nginx rename to init.d/nginx index ea82ec9f..aa36ab86 100644 --- a/nginx +++ b/init.d/nginx @@ -34,7 +34,7 @@ start(){ exit 1 fi echo -n $"Starting $prog:" - daemon $nginxd -c ${nginx_config} + #daemon $nginxd -c ${nginx_config} RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx diff --git a/start.sh b/start.sh index 2a3717fa..307eb6a0 100644 --- a/start.sh +++ b/start.sh @@ -16,7 +16,7 @@ if [ "${1:0:1}" = '-' ]; then set -- nginx "$@" fi -if [[ -e /var/lock ]]; then +if [[ -h /var/lock ]]; then rm -rf /var/lock [ -f /var/lock/subsys ] || mkdir -p /var/lock/subsys #touch /var/lock/subsys/nginx @@ -85,8 +85,9 @@ fi #/usr/local/php7/sbin/php-fpm #/usr/local/nginx/sbin/nginx -#exec "$@" -g "daemon off;" /etc/init.d/php-fpm start -/usr/local/nginx/sbin/nginx +/etc/init.d/nginx start + +#exec "$@" -g "daemon off;" From eec160c28b317ab83a08e7639ce2a9e17955e265 Mon Sep 17 00:00:00 2001 From: skiy Date: Tue, 15 Dec 2015 18:02:38 +0800 Subject: [PATCH 12/67] update to other style --- Dockerfile | 20 +- init.d/functions | 595 ----------------------------------------------- init.d/network | 249 -------------------- init.d/nginx | 84 ------- start.sh | 15 +- 5 files changed, 2 insertions(+), 961 deletions(-) delete mode 100644 init.d/functions delete mode 100644 init.d/network delete mode 100644 init.d/nginx diff --git a/Dockerfile b/Dockerfile index b88010e3..807b50c1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,12 +31,6 @@ RUN rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch libmcrypt-devel && \ yum clean all -#Add init.d files -ADD init.d/* /etc/init.d/ -#ADD functions /etc/init.d/functions -#ADD network /etc/init.d/network -#ADD nginx /etc/init.d/nginx - #Add user RUN groupadd -r www && \ useradd -M -s /sbin/nologin -r -g www www @@ -55,7 +49,6 @@ RUN cd /home && \ --error-log-path=/var/log/nginx_error.log \ --http-log-path=/var/log/nginx_access.log \ --pid-path=/var/run/nginx.pid \ - --lock-path=/var/lock/subsys/nginx \ --with-pcre \ --with-http_ssl_module \ --without-mail_pop3_module \ @@ -63,11 +56,6 @@ RUN cd /home && \ --with-http_gzip_static_module && \ make && make install -#Add nginx.service -RUN chmod +x /etc/init.d/nginx && \ - chkconfig --add nginx && \ - chkconfig nginx on - #Make install php RUN cd /home && \ tar zvxf php-7.0.0.tar.gz && \ @@ -120,17 +108,11 @@ RUN cd /home/php-7.0.0/ && \ cp php.ini-production /usr/local/php7/etc/php.ini && \ cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf && \ cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf && \ - cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm && \ - chmod +x /etc/init.d/php-fpm && \ - chkconfig --add php-fpm && \ - chkconfig php-fpm on #Remove zips #RUN cd / && rm -rf /home/{php-7.0.0*} #Create web folder -#RUN mkdir -p /data/www -#RUN chown -Rf www-data.www-data /data/www VOLUME ["/data/www", "/usr/local/nginx/conf/ssl", "/usr/local/nginx/conf/vhost"] ADD index.php /data/www/index.php @@ -149,4 +131,4 @@ EXPOSE 80 443 #Start web server CMD ["/bin/bash", "/start.sh"] -#CMD ["nginx"] +#CMD ["nginx", "php-fpm"] diff --git a/init.d/functions b/init.d/functions deleted file mode 100644 index f69821f0..00000000 --- a/init.d/functions +++ /dev/null @@ -1,595 +0,0 @@ -# -*-Shell-script-*- -# -# functions This file contains functions to be used by most or all -# shell scripts in the /etc/init.d directory. -# - -TEXTDOMAIN=initscripts - -# Make sure umask is sane -umask 022 - -# Set up a default search path. -PATH="/sbin:/usr/sbin:/bin:/usr/bin" -export PATH - -if [ $PPID -ne 1 -a -z "$SYSTEMCTL_SKIP_REDIRECT" ] && \ - ( /bin/mountpoint -q /cgroup/systemd || /bin/mountpoint -q /sys/fs/cgroup/systemd ) ; then - case "$0" in - /etc/init.d/*|/etc/rc.d/init.d/*) - _use_systemctl=1 - ;; - esac -fi - -systemctl_redirect () { - local s - local prog=${1##*/} - local command=$2 - local options="" - - case "$command" in - start) - s=$"Starting $prog (via systemctl): " - ;; - stop) - s=$"Stopping $prog (via systemctl): " - ;; - reload|try-reload) - s=$"Reloading $prog configuration (via systemctl): " - ;; - restart|try-restart|condrestart) - s=$"Restarting $prog (via systemctl): " - ;; - esac - - if [ -n "$SYSTEMCTL_IGNORE_DEPENDENCIES" ] ; then - options="--ignore-dependencies" - fi - - action "$s" /bin/systemctl $options $command "$prog.service" -} - -# Get a sane screen width -[ -z "${COLUMNS:-}" ] && COLUMNS=80 - -if [ -z "${CONSOLETYPE:-}" ]; then - if [ -c "/dev/stderr" -a -r "/dev/stderr" ]; then - CONSOLETYPE="$(/sbin/consoletype < /dev/stderr 2>/dev/null)" - else - CONSOLETYPE="serial" - fi -fi - -if [ -z "${NOLOCALE:-}" ] && [ -z "${LANGSH_SOURCED:-}" ] && [ -f /etc/sysconfig/i18n -o -f /etc/locale.conf ] ; then - . /etc/profile.d/lang.sh 2>/dev/null - # avoid propagating LANGSH_SOURCED any further - unset LANGSH_SOURCED -fi - -# Read in our configuration -if [ -z "${BOOTUP:-}" ]; then - if [ -f /etc/sysconfig/init ]; then - . /etc/sysconfig/init - else - # This all seem confusing? Look in /etc/sysconfig/init, - # or in /usr/share/doc/initscripts-*/sysconfig.txt - BOOTUP=color - RES_COL=60 - MOVE_TO_COL="echo -en \\033[${RES_COL}G" - SETCOLOR_SUCCESS="echo -en \\033[1;32m" - SETCOLOR_FAILURE="echo -en \\033[1;31m" - SETCOLOR_WARNING="echo -en \\033[1;33m" - SETCOLOR_NORMAL="echo -en \\033[0;39m" - LOGLEVEL=1 - fi - if [ "$CONSOLETYPE" = "serial" ]; then - BOOTUP=serial - MOVE_TO_COL= - SETCOLOR_SUCCESS= - SETCOLOR_FAILURE= - SETCOLOR_WARNING= - SETCOLOR_NORMAL= - fi -fi - -# Check if any of $pid (could be plural) are running -checkpid() { - local i - - for i in $* ; do - [ -d "/proc/$i" ] && return 0 - done - return 1 -} - -# __proc_pids {program} [pidfile] -# Set $pid to pids from /var/run* for {program}. $pid should be declared -# local in the caller. -# Returns LSB exit code for the 'status' action. -__pids_var_run() { - local base=${1##*/} - local pid_file=${2:-/var/run/$base.pid} - - pid= - if [ -f "$pid_file" ] ; then - local line p - - [ ! -r "$pid_file" ] && return 4 # "user had insufficient privilege" - while : ; do - read line - [ -z "$line" ] && break - for p in $line ; do - [ -z "${p//[0-9]/}" ] && [ -d "/proc/$p" ] && pid="$pid $p" - done - done < "$pid_file" - - if [ -n "$pid" ]; then - return 0 - fi - return 1 # "Program is dead and /var/run pid file exists" - fi - return 3 # "Program is not running" -} - -# Output PIDs of matching processes, found using pidof -__pids_pidof() { - pidof -c -m -o $$ -o $PPID -o %PPID -x "$1" || \ - pidof -c -m -o $$ -o $PPID -o %PPID -x "${1##*/}" -} - - -# A function to start a program. -daemon() { - # Test syntax. - local gotbase= force= nicelevel corelimit - local pid base= user= nice= bg= pid_file= - local cgroup= - nicelevel=0 - while [ "$1" != "${1##[-+]}" ]; do - case $1 in - '') echo $"$0: Usage: daemon [+/-nicelevel] {program}" - return 1;; - --check) - base=$2 - gotbase="yes" - shift 2 - ;; - --check=?*) - base=${1#--check=} - gotbase="yes" - shift - ;; - --user) - user=$2 - shift 2 - ;; - --user=?*) - user=${1#--user=} - shift - ;; - --pidfile) - pid_file=$2 - shift 2 - ;; - --pidfile=?*) - pid_file=${1#--pidfile=} - shift - ;; - --force) - force="force" - shift - ;; - [-+][0-9]*) - nice="nice -n $1" - shift - ;; - *) echo $"$0: Usage: daemon [+/-nicelevel] {program}" - return 1;; - esac - done - - # Save basename. - [ -z "$gotbase" ] && base=${1##*/} - - # See if it's already running. Look *only* at the pid file. - __pids_var_run "$base" "$pid_file" - - [ -n "$pid" -a -z "$force" ] && return - - # make sure it doesn't core dump anywhere unless requested - corelimit="ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0}" - - # if they set NICELEVEL in /etc/sysconfig/foo, honor it - [ -n "${NICELEVEL:-}" ] && nice="nice -n $NICELEVEL" - - # if they set CGROUP_DAEMON in /etc/sysconfig/foo, honor it - if [ -n "${CGROUP_DAEMON}" ]; then - if [ ! -x /bin/cgexec ]; then - echo -n "Cgroups not installed"; warning - echo - else - cgroup="/bin/cgexec"; - for i in $CGROUP_DAEMON; do - cgroup="$cgroup -g $i"; - done - fi - fi - - # Echo daemon - [ "${BOOTUP:-}" = "verbose" -a -z "${LSB:-}" ] && echo -n " $base" - - # And start it up. - if [ -z "$user" ]; then - $cgroup $nice /bin/bash -c "$corelimit >/dev/null 2>&1 ; $*" - else - $cgroup $nice runuser -s /bin/bash $user -c "$corelimit >/dev/null 2>&1 ; $*" - fi - - [ "$?" -eq 0 ] && success $"$base startup" || failure $"$base startup" -} - -# A function to stop a program. -killproc() { - local RC killlevel= base pid pid_file= delay try - - RC=0; delay=3; try=0 - # Test syntax. - if [ "$#" -eq 0 ]; then - echo $"Usage: killproc [-p pidfile] [ -d delay] {program} [-signal]" - return 1 - fi - if [ "$1" = "-p" ]; then - pid_file=$2 - shift 2 - fi - if [ "$1" = "-d" ]; then - delay=$(echo $2 | awk -v RS=' ' -v IGNORECASE=1 '{if($1!~/^[0-9.]+[smhd]?$/) exit 1;d=$1~/s$|^[0-9.]*$/?1:$1~/m$/?60:$1~/h$/?60*60:$1~/d$/?24*60*60:-1; -if(d==-1) exit 1;delay+=d*$1} END {printf("%d",delay+0.5)}') - if [ "$?" -eq 1 ]; then - echo $"Usage: killproc [-p pidfile] [ -d delay] {program} [-signal]" - return 1 - fi - shift 2 - fi - - - # check for second arg to be kill level - [ -n "${2:-}" ] && killlevel=$2 - - # Save basename. - base=${1##*/} - - # Find pid. - __pids_var_run "$1" "$pid_file" - RC=$? - if [ -z "$pid" ]; then - if [ -z "$pid_file" ]; then - pid="$(__pids_pidof "$1")" - else - [ "$RC" = "4" ] && { failure $"$base shutdown" ; return $RC ;} - fi - fi - - # Kill it. - if [ -n "$pid" ] ; then - [ "$BOOTUP" = "verbose" -a -z "${LSB:-}" ] && echo -n "$base " - if [ -z "$killlevel" ] ; then - if checkpid $pid 2>&1; then - # TERM first, then KILL if not dead - kill -TERM $pid >/dev/null 2>&1 - usleep 50000 - if checkpid $pid ; then - try=0 - while [ $try -lt $delay ] ; do - checkpid $pid || break - sleep 1 - let try+=1 - done - if checkpid $pid ; then - kill -KILL $pid >/dev/null 2>&1 - usleep 50000 - fi - fi - fi - checkpid $pid - RC=$? - [ "$RC" -eq 0 ] && failure $"$base shutdown" || success $"$base shutdown" - RC=$((! $RC)) - # use specified level only - else - if checkpid $pid; then - kill $killlevel $pid >/dev/null 2>&1 - RC=$? - [ "$RC" -eq 0 ] && success $"$base $killlevel" || failure $"$base $killlevel" - elif [ -n "${LSB:-}" ]; then - RC=7 # Program is not running - fi - fi - else - if [ -n "${LSB:-}" -a -n "$killlevel" ]; then - RC=7 # Program is not running - else - failure $"$base shutdown" - RC=0 - fi - fi - - # Remove pid file if any. - if [ -z "$killlevel" ]; then - rm -f "${pid_file:-/var/run/$base.pid}" - fi - return $RC -} - -# A function to find the pid of a program. Looks *only* at the pidfile -pidfileofproc() { - local pid - - # Test syntax. - if [ "$#" = 0 ] ; then - echo $"Usage: pidfileofproc {program}" - return 1 - fi - - __pids_var_run "$1" - [ -n "$pid" ] && echo $pid - return 0 -} - -# A function to find the pid of a program. -pidofproc() { - local RC pid pid_file= - - # Test syntax. - if [ "$#" = 0 ]; then - echo $"Usage: pidofproc [-p pidfile] {program}" - return 1 - fi - if [ "$1" = "-p" ]; then - pid_file=$2 - shift 2 - fi - fail_code=3 # "Program is not running" - - # First try "/var/run/*.pid" files - __pids_var_run "$1" "$pid_file" - RC=$? - if [ -n "$pid" ]; then - echo $pid - return 0 - fi - - [ -n "$pid_file" ] && return $RC - __pids_pidof "$1" || return $RC -} - -status() { - local base pid lock_file= pid_file= - - # Test syntax. - if [ "$#" = 0 ] ; then - echo $"Usage: status [-p pidfile] {program}" - return 1 - fi - if [ "$1" = "-p" ]; then - pid_file=$2 - shift 2 - fi - if [ "$1" = "-l" ]; then - lock_file=$2 - shift 2 - fi - base=${1##*/} - - if [ "$_use_systemctl" = "1" ]; then - systemctl status ${0##*/}.service - return $? - fi - - # First try "pidof" - __pids_var_run "$1" "$pid_file" - RC=$? - if [ -z "$pid_file" -a -z "$pid" ]; then - pid="$(__pids_pidof "$1")" - fi - if [ -n "$pid" ]; then - echo $"${base} (pid $pid) is running..." - return 0 - fi - - case "$RC" in - 0) - echo $"${base} (pid $pid) is running..." - return 0 - ;; - 1) - echo $"${base} dead but pid file exists" - return 1 - ;; - 4) - echo $"${base} status unknown due to insufficient privileges." - return 4 - ;; - esac - if [ -z "${lock_file}" ]; then - lock_file=${base} - fi - # See if /var/lock/subsys/${lock_file} exists - if [ -f /var/lock/subsys/${lock_file} ]; then - echo $"${base} dead but subsys locked" - return 2 - fi - echo $"${base} is stopped" - return 3 -} - -echo_success() { - [ "$BOOTUP" = "color" ] && $MOVE_TO_COL - echo -n "[" - [ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS - echo -n $" OK " - [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL - echo -n "]" - echo -ne "\r" - return 0 -} - -echo_failure() { - [ "$BOOTUP" = "color" ] && $MOVE_TO_COL - echo -n "[" - [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE - echo -n $"FAILED" - [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL - echo -n "]" - echo -ne "\r" - return 1 -} - -echo_passed() { - [ "$BOOTUP" = "color" ] && $MOVE_TO_COL - echo -n "[" - [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING - echo -n $"PASSED" - [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL - echo -n "]" - echo -ne "\r" - return 1 -} - -echo_warning() { - [ "$BOOTUP" = "color" ] && $MOVE_TO_COL - echo -n "[" - [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING - echo -n $"WARNING" - [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL - echo -n "]" - echo -ne "\r" - return 1 -} - -# Inform the graphical boot of our current state -update_boot_stage() { - if [ -x /bin/plymouth ]; then - /bin/plymouth --update="$1" - fi - return 0 -} - -# Log that something succeeded -success() { - [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_success - return 0 -} - -# Log that something failed -failure() { - local rc=$? - [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_failure - [ -x /bin/plymouth ] && /bin/plymouth --details - return $rc -} - -# Log that something passed, but may have had errors. Useful for fsck -passed() { - local rc=$? - [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_passed - return $rc -} - -# Log a warning -warning() { - local rc=$? - [ "$BOOTUP" != "verbose" -a -z "${LSB:-}" ] && echo_warning - return $rc -} - -# Run some action. Log its output. -action() { - local STRING rc - - STRING=$1 - echo -n "$STRING " - shift - "$@" && success $"$STRING" || failure $"$STRING" - rc=$? - echo - return $rc -} - -# returns OK if $1 contains $2 -strstr() { - [ "${1#*$2*}" = "$1" ] && return 1 - return 0 -} - -# Check whether file $1 is a backup or rpm-generated file and should be ignored -is_ignored_file() { - case "$1" in - *~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave) - return 0 - ;; - esac - return 1 -} - -# Evaluate shvar-style booleans -is_true() { - case "$1" in - [tT] | [yY] | [yY][eE][sS] | [tT][rR][uU][eE]) - return 0 - ;; - esac - return 1 -} - -# Evaluate shvar-style booleans -is_false() { - case "$1" in - [fF] | [nN] | [nN][oO] | [fF][aA][lL][sS][eE]) - return 0 - ;; - esac - return 1 -} - -# Apply sysctl settings, including files in /etc/sysctl.d -apply_sysctl() { - if [ -x /lib/systemd/systemd-sysctl ]; then - /lib/systemd/systemd-sysctl - else - for file in /usr/lib/sysctl.d/*.conf ; do - is_ignored_file "$file" && continue - [ -f /run/sysctl.d/${file##*/} ] && continue - [ -f /etc/sysctl.d/${file##*/} ] && continue - test -f "$file" && sysctl -e -p "$file" >/dev/null 2>&1 - done - for file in /run/sysctl.d/*.conf ; do - is_ignored_file "$file" && continue - [ -f /etc/sysctl.d/${file##*/} ] && continue - test -f "$file" && sysctl -e -p "$file" >/dev/null 2>&1 - done - for file in /etc/sysctl.d/*.conf ; do - is_ignored_file "$file" && continue - test -f "$file" && sysctl -e -p "$file" >/dev/null 2>&1 - done - sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1 - fi -} - -# A sed expression to filter out the files that is_ignored_file recognizes -__sed_discard_ignored_files='/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d' - -if [ "$_use_systemctl" = "1" ]; then - if [ "x$1" = xstart -o \ - "x$1" = xstop -o \ - "x$1" = xrestart -o \ - "x$1" = xreload -o \ - "x$1" = xtry-restart -o \ - "x$1" = xforce-reload -o \ - "x$1" = xcondrestart ] ; then - - systemctl_redirect $0 $1 - exit $? - fi -fi \ No newline at end of file diff --git a/init.d/network b/init.d/network deleted file mode 100644 index e287c7b2..00000000 --- a/init.d/network +++ /dev/null @@ -1,249 +0,0 @@ -#! /bin/bash -# -# network Bring up/down networking -# -# chkconfig: 2345 10 90 -# description: Activates/Deactivates all network interfaces configured to \ -# start at boot time. -# -### BEGIN INIT INFO -# Provides: $network -# Should-Start: iptables ip6tables NetworkManager-wait-online NetworkManager -# Short-Description: Bring up/down networking -# Description: Bring up/down networking -### END INIT INFO - -# Source function library. -. /etc/init.d/functions - -if [ ! -f /etc/sysconfig/network ]; then - exit 6 -fi - -. /etc/sysconfig/network - -if [ -f /etc/sysconfig/pcmcia ]; then - . /etc/sysconfig/pcmcia -fi - - -# Check that networking is up. -[ "${NETWORKING}" = "no" ] && exit 6 - -# if the ip configuration utility isn't around we can't function. -[ -x /sbin/ip ] || exit 1 - - -CWD=$(pwd) -cd /etc/sysconfig/network-scripts - -. ./network-functions - -# find all the interfaces besides loopback. -# ignore aliases, alternative configurations, and editor backup files -interfaces=$(ls ifcfg-* | \ - LC_ALL=C sed -e "$__sed_discard_ignored_files" \ - -e '/\(ifcfg-lo$\|:\|ifcfg-.*-range\)/d' \ - -e '{ s/^ifcfg-//g;s/[0-9]/ &/}' | \ - LC_ALL=C sort -k 1,1 -k 2n | \ - LC_ALL=C sed 's/ //') -rc=0 - -# See how we were called. -case "$1" in - start) - [ "$EUID" != "0" ] && exit 4 - rc=0 - # IPv6 hook (pre IPv4 start) - if [ -x /etc/sysconfig/network-scripts/init.ipv6-global ]; then - /etc/sysconfig/network-scripts/init.ipv6-global start pre - fi - - apply_sysctl - - # bring up loopback interface - action $"Bringing up loopback interface: " ./ifup ifcfg-lo - - case "$VLAN" in - yes) - if [ ! -d /proc/net/vlan ] && ! modprobe 8021q >/dev/null 2>&1 ; then - net_log $"No 802.1Q VLAN support available in kernel." - fi - ;; - esac - - vlaninterfaces="" - vpninterfaces="" - xdslinterfaces="" - bridgeinterfaces="" - - # bring up all other interfaces configured to come up at boot time - for i in $interfaces; do - unset DEVICE TYPE SLAVE - eval $(LANG=C grep -F "DEVICE=" ifcfg-$i) - eval $(LANG=C grep -F "TYPE=" ifcfg-$i) - eval $(LANG=C grep -F "SLAVE=" ifcfg-$i) - eval $(LANG=C grep -F "NM_CONTROLLED=" ifcfg-$i) - - if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi - - if [ "$SLAVE" = "yes" ] && ( ! is_nm_running || is_false $NM_CONTROLLED ) ; then - continue - fi - - if [ "${DEVICE##cipcb}" != "$DEVICE" ] ; then - vpninterfaces="$vpninterfaces $i" - continue - fi - if [ "$TYPE" = "xDSL" ]; then - xdslinterfaces="$xdslinterfaces $i" - continue - fi - - if [ "$TYPE" = "Bridge" ]; then - bridgeinterfaces="$bridgeinterfaces $i" - continue - fi - if [ "$TYPE" = "IPSEC" ]; then - vpninterfaces="$vpninterfaces $i" - continue - fi - - if [ "${DEVICE%%.*}" != "$DEVICE" -o "${DEVICE##vlan}" != "$DEVICE" ] ; then - vlaninterfaces="$vlaninterfaces $i" - continue - fi - - if LANG=C grep -EL "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i > /dev/null ; then - # this loads the module, to preserve ordering - is_available $i - continue - fi - action $"Bringing up interface $i: " ./ifup $i boot - [ $? -ne 0 ] && rc=1 - done - - # Bring up xDSL and VPN interfaces - for i in $vlaninterfaces $bridgeinterfaces $xdslinterfaces $vpninterfaces ; do - if ! LANG=C grep -EL "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i >/dev/null 2>&1 ; then - action $"Bringing up interface $i: " ./ifup $i boot - [ $? -ne 0 ] && rc=1 - fi - done - - # Add non interface-specific static-routes. - if [ -f /etc/sysconfig/static-routes ]; then - if [ -x /sbin/route ]; then - grep "^any" /etc/sysconfig/static-routes | while read ignore args ; do - /sbin/route add -$args - done - else - net_log $"Legacy static-route support not available: /sbin/route not found" - fi - fi - - # IPv6 hook (post IPv4 start) - if [ -x /etc/sysconfig/network-scripts/init.ipv6-global ]; then - /etc/sysconfig/network-scripts/init.ipv6-global start post - fi - # Run this again to catch any interface-specific actions - apply_sysctl - - touch /var/lock/subsys/network - - [ -n "${NETWORKDELAY}" ] && /bin/sleep ${NETWORKDELAY} - ;; - stop) - [ "$EUID" != "0" ] && exit 4 - # Don't shut the network down if root is on NFS or a network - # block device. - rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/" && $3 != "rootfs") { print $3; }}' /proc/mounts) - rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab) - - if [[ "$rootfs" == nfs* || "$rootopts" =~ _r?netdev ]] ; then - exit 1 - fi - - systemctl show --property=RequiredBy -- -.mount | grep -q 'remote-fs.target' && exit 1 - - vlaninterfaces="" - vpninterfaces="" - xdslinterfaces="" - bridgeinterfaces="" - remaining="" - rc=0 - - # get list of bonding, vpn, and xdsl interfaces - for i in $interfaces; do - unset DEVICE TYPE - eval $(LANG=C grep -F "DEVICE=" ifcfg-$i) - eval $(LANG=C grep -F "TYPE=" ifcfg-$i) - - if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi - - if [ "${DEVICE##cipcb}" != "$DEVICE" ] ; then - vpninterfaces="$vpninterfaces $i" - continue - fi - if [ "$TYPE" = "IPSEC" ]; then - vpninterfaces="$vpninterfaces $i" - continue - fi - if [ "$TYPE" = "Bridge" ]; then - bridgeinterfaces="$bridgeinterfaces $i" - continue - fi - if [ "$TYPE" = "xDSL" ]; then - xdslinterfaces="$xdslinterfaces $i" - continue - fi - - if [ "${DEVICE%%.*}" != "$DEVICE" -o "${DEVICE##vlan}" != "$DEVICE" ] ; then - vlaninterfaces="$vlaninterfaces $i" - continue - fi - remaining="$remaining $i" - done - - for i in $vpninterfaces $xdslinterfaces $bridgeinterfaces $vlaninterfaces $remaining; do - unset DEVICE TYPE - (. ./ifcfg-$i - if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi - - if ! check_device_down $DEVICE; then - action $"Shutting down interface $i: " ./ifdown $i boot - [ $? -ne 0 ] && rc=1 - fi - ) - done - - action $"Shutting down loopback interface: " ./ifdown ifcfg-lo - - sysctl -w net.ipv4.ip_forward=0 > /dev/null 2>&1 - - # IPv6 hook (post IPv4 stop) - if [ -x /etc/sysconfig/network-scripts/init.ipv6-global ]; then - /etc/sysconfig/network-scripts/init.ipv6-global stop post - fi - - rm -f /var/lock/subsys/network - ;; - status) - echo $"Configured devices:" - echo lo $interfaces - - echo $"Currently active devices:" - echo $(/sbin/ip -o link show up | awk -F ": " '{ print $2 }') - ;; - restart|reload|force-reload) - cd "$CWD" - $0 stop - $0 start - rc=$? - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}" - exit 2 -esac - -exit $rc diff --git a/init.d/nginx b/init.d/nginx deleted file mode 100644 index aa36ab86..00000000 --- a/init.d/nginx +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash -# nginx Startup script for the Nginx HTTP Server -# this script create it by ivan at 2010.12.29. -# -# chkconfig: - 85 15 -# description: Nginx is a high-performance web and proxy server. -# It has a lot of features, but it's not for everyone. -# processname: nginx -# pidfile: /var/run/nginx.pid -# config: /etc/nginx.conf - -nginxd=/usr/local/nginx/sbin/nginx -nginx_config=/usr/local/nginx/conf/nginx.conf -nginx_pid=/var/run/nginx.pid - -RETVAL=0 -prog="nginx" - -# Source function library. -. /etc/rc.d/init.d/functions - -# Source networking configuration. -. /etc/sysconfig/network - -# Check that networking is up. -[ ${NETWORKING} = "no" ] && exit 0 -[ -x $nginxd ] || exit 0 - -# Start nginx daemons functions. -start(){ - - if [ -e $nginx_pid ]; then - echo "nginx already running..." - exit 1 - fi - echo -n $"Starting $prog:" - #daemon $nginxd -c ${nginx_config} - RETVAL=$? - echo - [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx - return $RETVAL -} - -# Stop nginx daemons functions. -stop(){ - echo -n $"Stopping $prog:" - killproc $nginxd - RETVAL=$? - echo - [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx $nginx_pid -} - -#reload nginx service functions. -reload(){ - echo -n $"Reloading $proc:" - killproc $nginxd -HUP - RETVAL=$? - echo -} -# See how we were called. -case "$1" in - start) - start - ;; - stop) - stop - ;; - reload) - reload - ;; - restart) - stop - start - ;; - status) - status $prog - RETVAL=$? - ;; - *) - echo $"Usage: $prog {start|stop|restart|reload|status|help}" - exit 1 -esac - -exit $RETVAL diff --git a/start.sh b/start.sh index 307eb6a0..a63c1256 100644 --- a/start.sh +++ b/start.sh @@ -6,7 +6,7 @@ # Version: # Created Time: 2015/12/13 ######################################################################### -PATH=/bin:/usr/local/nginx/sbin:$PATH +PATH=/bin:/usr/local/nginx/sbin:/usr/local/php7/sbin:$PATH Nginx_Install_Dir=/usr/local/nginx DATA_DIR=/data/www @@ -16,12 +16,6 @@ if [ "${1:0:1}" = '-' ]; then set -- nginx "$@" fi -if [[ -h /var/lock ]]; then - rm -rf /var/lock - [ -f /var/lock/subsys ] || mkdir -p /var/lock/subsys - #touch /var/lock/subsys/nginx -fi - chown -R www.www $DATA_DIR if [[ -n "$PROXY_WEB" ]]; then @@ -83,11 +77,4 @@ server { EOF fi -#/usr/local/php7/sbin/php-fpm -#/usr/local/nginx/sbin/nginx - -/etc/init.d/php-fpm start - -/etc/init.d/nginx start - #exec "$@" -g "daemon off;" From c8e14a41c777c571f55582a528e2886fddc2a368 Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 16 Dec 2015 00:29:18 +0800 Subject: [PATCH 13/67] update v0.0.2 --- Dockerfile | 25 +++++++++++++++++-------- start.sh | 7 +------ supervisord.conf | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 14 deletions(-) create mode 100644 supervisord.conf diff --git a/Dockerfile b/Dockerfile index 807b50c1..37dbb123 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,8 @@ FROM centos:7 MAINTAINER Skiychan #Install system library -RUN yum -y install \ - gcc \ +#RUN yum update -y +RUN yum install -y gcc \ gcc-c++ \ autoconf \ automake \ @@ -25,10 +25,12 @@ RUN rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch libxml2-devel \ libcurl \ libcurl-devel \ - libjpeg-devel \ libpng-devel \ + libjpeg-devel \ freetype-devel \ - libmcrypt-devel && \ + libmcrypt-devel \ + openssh-server \ + python-setuptools && \ yum clean all #Add user @@ -107,10 +109,19 @@ RUN cd /home && \ RUN cd /home/php-7.0.0/ && \ cp php.ini-production /usr/local/php7/etc/php.ini && \ cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf && \ - cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf && \ + cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf + +#Install supervisor +RUN easy_install supervisor && \ + mkdir -p /var/log/supervisor && \ + mkdir -p /var/run/sshd && \ + mkdir -p /var/run/supervisord + +#Add supervisord conf +ADD supervisord.conf /etc/supervisord.conf #Remove zips -#RUN cd / && rm -rf /home/{php-7.0.0*} +RUN cd / && rm -rf php-* nginx-* #Create web folder VOLUME ["/data/www", "/usr/local/nginx/conf/ssl", "/usr/local/nginx/conf/vhost"] @@ -130,5 +141,3 @@ EXPOSE 80 443 #Start web server CMD ["/bin/bash", "/start.sh"] - -#CMD ["nginx", "php-fpm"] diff --git a/start.sh b/start.sh index a63c1256..07b28683 100644 --- a/start.sh +++ b/start.sh @@ -6,16 +6,11 @@ # Version: # Created Time: 2015/12/13 ######################################################################### -PATH=/bin:/usr/local/nginx/sbin:/usr/local/php7/sbin:$PATH Nginx_Install_Dir=/usr/local/nginx DATA_DIR=/data/www set -e -if [ "${1:0:1}" = '-' ]; then - set -- nginx "$@" -fi - chown -R www.www $DATA_DIR if [[ -n "$PROXY_WEB" ]]; then @@ -77,4 +72,4 @@ server { EOF fi -#exec "$@" -g "daemon off;" +/usr/bin/supervisord -n -c /etc/supervisord.conf diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 00000000..cc1ee120 --- /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/php7/sbin/php-fpm +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 From 1aaa1de1c128fd20719c8f87ecb99dd55fcd057e Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 16 Dec 2015 16:17:54 +0800 Subject: [PATCH 14/67] fix https --- start.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/start.sh b/start.sh index 07b28683..c566ebc1 100644 --- a/start.sh +++ b/start.sh @@ -36,13 +36,13 @@ if [[ -n "$PROXY_WEB" ]]; then exit 1 fi - if [ -f "${Nginx_Install_Dir}/conf/ssl/${PROXY_CRT}" ]; then + 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 + 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 @@ -68,6 +68,17 @@ server { keepalive_timeout 70; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; + + root $DATA_DIR; + index index.php index.html index.htm; + + 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 From 64773494f4f3ed301a964a8377b2a7f5322b9a53 Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 16 Dec 2015 23:08:16 +0800 Subject: [PATCH 15/67] fix rewritex --- start.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/start.sh b/start.sh index 07b28683..6b4bb95f 100644 --- a/start.sh +++ b/start.sh @@ -36,13 +36,13 @@ if [[ -n "$PROXY_WEB" ]]; then exit 1 fi - if [ -f "${Nginx_Install_Dir}/conf/ssl/${PROXY_CRT}" ]; then + 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 + 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 @@ -68,6 +68,21 @@ server { 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 From 2187e6e7d413fab8976dd0fc5fda6de59c6ce23d Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 16 Dec 2015 23:14:44 +0800 Subject: [PATCH 16/67] add nightly version --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index bee4c9b0..72c2f9e5 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,11 @@ Pull the image from the docker index rather than downloading the git repo. This docker pull skiychan/nginx-php7:latest ``` +To pull the Nightly Version: +``` +docker pull skiychan/nginx-php7:nightly +``` + ## Running To simply run the container: ```sh From ab63fb6dd17a9c26f7703f347bac22c308abb098 Mon Sep 17 00:00:00 2001 From: skiy Date: Thu, 17 Dec 2015 00:12:26 +0800 Subject: [PATCH 17/67] fix rewrite \$ --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index 6b4bb95f..9701cd2e 100644 --- a/start.sh +++ b/start.sh @@ -73,7 +73,7 @@ server { index index.php index.html index.htm; location / { - try_files $uri $uri/ /index.php?$args; + try_files \$uri \$uri/ /index.php?\$args; } location ~ \.php$ { From cde70c7ce631ef366b7667c6c72a4082ff6a1c62 Mon Sep 17 00:00:00 2001 From: skiy Date: Thu, 24 Dec 2015 09:42:14 +0800 Subject: [PATCH 18/67] fixbugs --- Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index e346e6f9..116c925a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,12 +41,12 @@ RUN groupadd -r www && \ useradd -M -s /sbin/nologin -r -g www www #Download nginx & php -RUN cd /home && \ +RUN mkdir -p /home/nginx-php && cd $_ && \ wget -c -O nginx.tar.gz http://nginx.org/download/nginx-1.9.9.tar.gz && \ wget -O php.tar.gz http://am1.php.net/get/php-7.0.1.tar.gz/from/this/mirror #Make install nginx -RUN cd /home && \ +RUN cd /home/nginx-php && \ tar -zxvf nginx.tar.gz && \ cd nginx-1.9.9 && \ ./configure --prefix=/usr/local/nginx \ @@ -62,7 +62,7 @@ RUN cd /home && \ make && make install #Make install php -RUN cd /home && \ +RUN cd /home/nginx-php && \ tar zvxf php.tar.gz && \ cd php-7.0.1 && \ ./configure --prefix=/usr/local/php7 \ @@ -109,7 +109,7 @@ RUN cd /home && \ --without-pear && \ make && make install -RUN cd /home/php-7.0.1/ && \ +RUN cd /home/nginx-php/php-7.0.1 && \ cp php.ini-production /usr/local/php7/etc/php.ini && \ cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf && \ cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf @@ -124,7 +124,7 @@ RUN easy_install supervisor && \ ADD supervisord.conf /etc/supervisord.conf #Remove zips -RUN cd / && rm -rf php-* nginx-* +RUN cd / && rm -rf /home/nginx-php #Create web folder VOLUME ["/data/www", "/usr/local/nginx/conf/ssl", "/usr/local/nginx/conf/vhost"] From 077272e65e360878aa5525a606c21ad40f71b1c3 Mon Sep 17 00:00:00 2001 From: skiy Date: Sat, 9 Jan 2016 22:50:57 +0800 Subject: [PATCH 19/67] update php to version 7.0.2 --- Dockerfile | 10 ++++------ README.md | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index e346e6f9..6aeb9ea8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM centos:7 MAINTAINER Skiychan ## # Nginx: 1.9.9 -# PHP : 7.0.1 +# PHP : 7.0.2 ## #Install system library #RUN yum update -y @@ -64,7 +64,7 @@ RUN cd /home && \ #Make install php RUN cd /home && \ tar zvxf php.tar.gz && \ - cd php-7.0.1 && \ + cd php-7.0.2 && \ ./configure --prefix=/usr/local/php7 \ --with-config-file-path=/usr/local/php7/etc \ --with-config-file-scan-dir=/usr/local/php7/etc/php.d \ @@ -109,7 +109,7 @@ RUN cd /home && \ --without-pear && \ make && make install -RUN cd /home/php-7.0.1/ && \ +RUN cd /home/php-7.0.2/ && \ cp php.ini-production /usr/local/php7/etc/php.ini && \ cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf && \ cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf @@ -124,7 +124,7 @@ RUN easy_install supervisor && \ ADD supervisord.conf /etc/supervisord.conf #Remove zips -RUN cd / && rm -rf php-* nginx-* +RUN cd / && rm -rf /home/php-* nginx-* #Create web folder VOLUME ["/data/www", "/usr/local/nginx/conf/ssl", "/usr/local/nginx/conf/vhost"] @@ -140,7 +140,5 @@ RUN chmod +x /start.sh #Set port EXPOSE 80 443 -#ENTRYPOINT ["/start.sh"] - #Start web server CMD ["/bin/bash", "/start.sh"] diff --git a/README.md b/README.md index 546d64ef..79d10a98 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Nginx and PHP for Docker ## Version nginx: **1.9.9** -php: **7.0.1** +php: **7.0.2** ## 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. From 88f3fffbf1757a428a8c5f9d6822d42381d30972 Mon Sep 17 00:00:00 2001 From: skiy Date: Sat, 9 Jan 2016 23:40:54 +0800 Subject: [PATCH 20/67] fix less bug --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f0e629e5..8e55c915 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,7 +43,7 @@ RUN groupadd -r www && \ #Download nginx & php RUN mkdir -p /home/nginx-php && cd $_ && \ wget -c -O nginx.tar.gz http://nginx.org/download/nginx-1.9.9.tar.gz && \ - wget -O php.tar.gz http://am1.php.net/get/php-7.0.1.tar.gz/from/this/mirror + wget -O php.tar.gz http://am1.php.net/get/php-7.0.2.tar.gz/from/this/mirror #Make install nginx RUN cd /home/nginx-php && \ From d6157598e075ffad0f1c58c383fa31a4c4c16d6d Mon Sep 17 00:00:00 2001 From: skiy Date: Mon, 25 Jan 2016 13:33:33 +0800 Subject: [PATCH 21/67] add xdebug --- Dockerfile | 42 +++++++++++++++++++++++++++++------------- supervisord.conf | 2 +- xdebug.ini | 1 + 3 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 xdebug.ini diff --git a/Dockerfile b/Dockerfile index 8e55c915..7b5354f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,15 +40,20 @@ RUN rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch RUN groupadd -r www && \ useradd -M -s /sbin/nologin -r -g www www + +ENV PHP_VERSION 7.0.2 +ENV NGINX_VERSION 1.9.9 + #Download nginx & php RUN mkdir -p /home/nginx-php && cd $_ && \ - wget -c -O nginx.tar.gz http://nginx.org/download/nginx-1.9.9.tar.gz && \ - wget -O php.tar.gz http://am1.php.net/get/php-7.0.2.tar.gz/from/this/mirror + wget -c -O nginx.tar.gz http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && \ + wget -O php.tar.gz http://am1.php.net/get/php-$PHP_VERSION.tar.gz/from/this/mirror && \ + curl -O -SL https://github.com/xdebug/xdebug/archive/XDEBUG_2_4_0RC3.tar.gz #Make install nginx RUN cd /home/nginx-php && \ tar -zxvf nginx.tar.gz && \ - cd nginx-1.9.9 && \ + cd nginx-$NGINX_VERSION && \ ./configure --prefix=/usr/local/nginx \ --user=www --group=www \ --error-log-path=/var/log/nginx_error.log \ @@ -64,10 +69,10 @@ RUN cd /home/nginx-php && \ #Make install php RUN cd /home/nginx-php && \ tar zvxf php.tar.gz && \ - cd php-7.0.2 && \ - ./configure --prefix=/usr/local/php7 \ - --with-config-file-path=/usr/local/php7/etc \ - --with-config-file-scan-dir=/usr/local/php7/etc/php.d \ + cd 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 \ @@ -109,10 +114,19 @@ RUN cd /home/nginx-php && \ --without-pear && \ make && make install -RUN cd /home/nginx-php/php-7.0.2 && \ - cp php.ini-production /usr/local/php7/etc/php.ini && \ - cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf && \ - cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf +#Add xdebug extension +RUN cd /home/nginx-php && \ + tar -zxvf XDEBUG_2_4_0RC3.tar.gz && \ + cd xdebug-XDEBUG_2_4_0RC3 && \ + /usr/local/php/bin/phpize && \ + ./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config && \ + make && \ + cp modules/xdebug.so /usr/local/php/lib/php/extensions/xdebug.so + +RUN 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 RUN easy_install supervisor && \ @@ -127,9 +141,11 @@ ADD supervisord.conf /etc/supervisord.conf RUN cd / && rm -rf /home/nginx-php #Create web folder -VOLUME ["/data/www", "/usr/local/nginx/conf/ssl", "/usr/local/nginx/conf/vhost"] +VOLUME ["/data/www", "/usr/local/nginx/conf/ssl", "/usr/local/nginx/conf/vhost", "/usr/local/php/etc/php.d"] ADD index.php /data/www/index.php +ADD xdebug.ini /usr/local/php/etc/php.d/xdebug.ini + #Update nginx config ADD nginx.conf /usr/local/nginx/conf/nginx.conf @@ -138,7 +154,7 @@ ADD start.sh /start.sh RUN chmod +x /start.sh #Set port -EXPOSE 80 443 +EXPOSE 80 443 9000 #Start web server CMD ["/bin/bash", "/start.sh"] diff --git a/supervisord.conf b/supervisord.conf index cc1ee120..8fc30243 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -22,7 +22,7 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket [program:php-fpm] -command=/usr/local/php7/sbin/php-fpm +command=/usr/local/php/sbin/php-fpm autostart=true autorestart=true priority=5 diff --git a/xdebug.ini b/xdebug.ini new file mode 100644 index 00000000..129b9638 --- /dev/null +++ b/xdebug.ini @@ -0,0 +1 @@ +extension=/usr/local/php/lib/php/extensions/xdebug.so \ No newline at end of file From f841634e6bceebcad4489220425fb4f6346c28fa Mon Sep 17 00:00:00 2001 From: skiy Date: Mon, 25 Jan 2016 13:40:24 +0800 Subject: [PATCH 22/67] update Changelog --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 79d10a98..e9f99306 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,14 @@ docker run -d --name=nginx \ skiychan/nginx-php7 ``` +## Enabling Extensions +```sh +docker run --name nginx -p 8080:80 -d -v /your_php_extension:/usr/local/php/etc/php.d skiychan/nginx-php7 +``` + +## ChangeLog +**2016.01.25** ADD XDEBUG + ## Author Author: Skiychan Email: dev@skiy.net From f6e54a49132886dd5a1214d9fef018ac10298e45 Mon Sep 17 00:00:00 2001 From: skiy Date: Mon, 25 Jan 2016 13:50:21 +0800 Subject: [PATCH 23/67] update README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e9f99306..fa91e468 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,8 @@ docker run --name nginx -p 8080:80 -d -v /your_php_extension:/usr/local/php/etc/ ``` ## ChangeLog -**2016.01.25** ADD XDEBUG +**2016.01.25** +Add xdebug support ## Author Author: Skiychan From f41f47cc7ccaeaa2c461d35924e27be871c55bc5 Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 27 Jan 2016 13:58:33 +0800 Subject: [PATCH 24/67] Update nginx to version 1.9.10 --- Dockerfile | 4 ++-- README.md | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7b5354f6..e3dd15a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM centos:7 MAINTAINER Skiychan ## -# Nginx: 1.9.9 +# Nginx: 1.9.10 # PHP : 7.0.2 ## #Install system library @@ -42,7 +42,7 @@ RUN groupadd -r www && \ ENV PHP_VERSION 7.0.2 -ENV NGINX_VERSION 1.9.9 +ENV NGINX_VERSION 1.9.10 #Download nginx & php RUN mkdir -p /home/nginx-php && cd $_ && \ diff --git a/README.md b/README.md index fa91e468..398a08b5 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,9 @@ docker run --name nginx -p 8080:80 -d -v /your_php_extension:/usr/local/php/etc/ ## ChangeLog **2016.01.25** Add xdebug support + +**2016.01.27** +Update nginx to version 1.9.10 ## Author Author: Skiychan From 21852d4ed815b10f4cb02431d2d6704438020e59 Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 27 Jan 2016 14:34:26 +0800 Subject: [PATCH 25/67] update flag --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 398a08b5..61526df7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Nginx and PHP for Docker ## Version -nginx: **1.9.9** +nginx: **1.9.10** php: **7.0.2** ## Installation From 72ae9747395ae2e69cc92479cc5d05f05ac5b197 Mon Sep 17 00:00:00 2001 From: skiy Date: Fri, 29 Jan 2016 13:40:38 +0800 Subject: [PATCH 26/67] Add fileinfo support Add ipv6 support --- Dockerfile | 9 ++++++--- README.md | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index e3dd15a0..06df95f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -107,9 +107,9 @@ RUN cd /home/nginx-php && \ --enable-opcache \ --enable-bcmath \ --enable-exif \ - --disable-fileinfo \ + --enable-fileinfo \ --disable-rpath \ - --disable-ipv6 \ + --enable-ipv6 \ --disable-debug \ --without-pear && \ make && make install @@ -156,5 +156,8 @@ RUN chmod +x /start.sh #Set port EXPOSE 80 443 9000 +#Start it +ENTRYPOINT ["/start.sh"] + #Start web server -CMD ["/bin/bash", "/start.sh"] +#CMD ["/bin/bash", "/start.sh"] diff --git a/README.md b/README.md index 61526df7..6ad20d89 100644 --- a/README.md +++ b/README.md @@ -46,12 +46,16 @@ docker run --name nginx -p 8080:80 -d -v /your_php_extension:/usr/local/php/etc/ ``` ## ChangeLog -**2016.01.25** +**2016.01.25:** Add xdebug support -**2016.01.27** +**2016.01.27:** Update nginx to version 1.9.10 +**2016.01.29:** +Add fileinfo support +Add ipv6 support + ## Author Author: Skiychan Email: dev@skiy.net From bfb114c25f50627fafcda5dbf60d67c0e96eb3bf Mon Sep 17 00:00:00 2001 From: skiy Date: Thu, 4 Feb 2016 11:27:59 +0800 Subject: [PATCH 27/67] update php to version 7.0.3 --- Dockerfile | 14 +++++++------- README.md | 20 ++++++++++++-------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 06df95f1..622c89c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,14 @@ FROM centos:7 MAINTAINER Skiychan ## # Nginx: 1.9.10 -# PHP : 7.0.2 +# PHP : 7.0.3 ## #Install system library #RUN yum update -y + +ENV PHP_VERSION 7.0.3 +ENV NGINX_VERSION 1.9.10 + RUN yum install -y gcc \ gcc-c++ \ autoconf \ @@ -38,16 +42,12 @@ RUN rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch #Add user RUN groupadd -r www && \ - useradd -M -s /sbin/nologin -r -g www www - - -ENV PHP_VERSION 7.0.2 -ENV NGINX_VERSION 1.9.10 + useradd -M -s /sbin/nologin -r -g www www #Download nginx & php RUN mkdir -p /home/nginx-php && cd $_ && \ wget -c -O nginx.tar.gz http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && \ - wget -O php.tar.gz http://am1.php.net/get/php-$PHP_VERSION.tar.gz/from/this/mirror && \ + wget -O php.tar.gz http://php.net/distributions/php-$PHP_VERSION.tar.gz && \ curl -O -SL https://github.com/xdebug/xdebug/archive/XDEBUG_2_4_0RC3.tar.gz #Make install nginx diff --git a/README.md b/README.md index 6ad20d89..9301b760 100644 --- a/README.md +++ b/README.md @@ -45,16 +45,20 @@ skiychan/nginx-php7 docker run --name nginx -p 8080:80 -d -v /your_php_extension:/usr/local/php/etc/php.d skiychan/nginx-php7 ``` -## ChangeLog -**2016.01.25:** -Add xdebug support - -**2016.01.27:** -Update nginx to version 1.9.10 +## ChangeLog +**2016/02/04:** +Update php to version 7.0.3 -**2016.01.29:** +**2016/01/29:** Add fileinfo support -Add ipv6 support +Add ipv6 support + +**2016/01/27:** +Update nginx to version 1.9.10 + +**2016/01/25:** +Add xdebug support + ## Author Author: Skiychan From 0737449bc5e57e814c2bb1f7e0f1ed709b01bf0b Mon Sep 17 00:00:00 2001 From: skiy Date: Thu, 4 Feb 2016 11:40:06 +0800 Subject: [PATCH 28/67] update readme --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9301b760..80a7c3cf 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Nginx and PHP for Docker ## Version nginx: **1.9.10** -php: **7.0.2** +php: **7.0.3** ## 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. @@ -46,21 +46,21 @@ docker run --name nginx -p 8080:80 -d -v /your_php_extension:/usr/local/php/etc/ ``` ## ChangeLog -**2016/02/04:** +**2016 / 02 / 04:** Update php to version 7.0.3 -**2016/01/29:** +**2016 / 01 / 29:** Add fileinfo support Add ipv6 support -**2016/01/27:** +**2016 / 01 / 27:** Update nginx to version 1.9.10 -**2016/01/25:** +**2016 / 01 / 25:** Add xdebug support ## Author Author: Skiychan Email: dev@skiy.net -Link: http://www.zzzzy.com +Link: https://www.zzzzy.com From 8f6fc6ac6f65ec8bb1fcf390a00ed6a9de1c0990 Mon Sep 17 00:00:00 2001 From: skiy Date: Sat, 13 Feb 2016 23:51:21 +0800 Subject: [PATCH 29/67] update nginx to version 1.9.11 --- Dockerfile | 4 ++-- README.md | 5 ++++- index.php | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 622c89c6..6188652c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ FROM centos:7 MAINTAINER Skiychan ## -# Nginx: 1.9.10 +# Nginx: 1.9.11 # PHP : 7.0.3 ## #Install system library #RUN yum update -y ENV PHP_VERSION 7.0.3 -ENV NGINX_VERSION 1.9.10 +ENV NGINX_VERSION 1.9.11 RUN yum install -y gcc \ gcc-c++ \ diff --git a/README.md b/README.md index 80a7c3cf..f296afc4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Nginx and PHP for Docker ## Version -nginx: **1.9.10** +nginx: **1.9.11** php: **7.0.3** ## Installation @@ -46,6 +46,9 @@ docker run --name nginx -p 8080:80 -d -v /your_php_extension:/usr/local/php/etc/ ``` ## ChangeLog +**2016 / 02 / 13:** +Update nginx to version 1.9.11 + **2016 / 02 / 04:** Update php to version 7.0.3 diff --git a/index.php b/index.php index 5f1148a3..7e51974b 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@ -GitHub: https://github.com/skiy-dockerfile/nginx-php7
+Docker Hub: https://hub.docker.com/r/skiychan/nginx-php7
+ Date: Sun, 14 Feb 2016 00:19:46 +0800 Subject: [PATCH 30/67] update --- Dockerfile | 4 ++-- README.md | 5 ++++- index.php | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 622c89c6..6188652c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ FROM centos:7 MAINTAINER Skiychan ## -# Nginx: 1.9.10 +# Nginx: 1.9.11 # PHP : 7.0.3 ## #Install system library #RUN yum update -y ENV PHP_VERSION 7.0.3 -ENV NGINX_VERSION 1.9.10 +ENV NGINX_VERSION 1.9.11 RUN yum install -y gcc \ gcc-c++ \ diff --git a/README.md b/README.md index 80a7c3cf..f296afc4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Nginx and PHP for Docker ## Version -nginx: **1.9.10** +nginx: **1.9.11** php: **7.0.3** ## Installation @@ -46,6 +46,9 @@ docker run --name nginx -p 8080:80 -d -v /your_php_extension:/usr/local/php/etc/ ``` ## ChangeLog +**2016 / 02 / 13:** +Update nginx to version 1.9.11 + **2016 / 02 / 04:** Update php to version 7.0.3 diff --git a/index.php b/index.php index 5f1148a3..7e51974b 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@ -GitHub: https://github.com/skiy-dockerfile/nginx-php7
+Docker Hub: https://hub.docker.com/r/skiychan/nginx-php7
+ Date: Mon, 29 Feb 2016 09:05:32 +0800 Subject: [PATCH 31/67] udpate nginx to version 1.9.12 --- Dockerfile | 4 ++-- README.md | 5 ++++- index.php | 6 +++-- nginx.conf | 64 ++++-------------------------------------------------- start.sh | 2 +- 5 files changed, 15 insertions(+), 66 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6188652c..bc920039 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ FROM centos:7 MAINTAINER Skiychan ## -# Nginx: 1.9.11 +# Nginx: 1.9.12 # PHP : 7.0.3 ## #Install system library #RUN yum update -y ENV PHP_VERSION 7.0.3 -ENV NGINX_VERSION 1.9.11 +ENV NGINX_VERSION 1.9.12 RUN yum install -y gcc \ gcc-c++ \ diff --git a/README.md b/README.md index f296afc4..3ed8fe59 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Nginx and PHP for Docker ## Version -nginx: **1.9.11** +nginx: **1.9.12** php: **7.0.3** ## Installation @@ -46,6 +46,9 @@ docker run --name nginx -p 8080:80 -d -v /your_php_extension:/usr/local/php/etc/ ``` ## ChangeLog +**2016 / 02 / 29:** +Update nginx to version 1.9.12 + **2016 / 02 / 13:** Update nginx to version 1.9.11 diff --git a/index.php b/index.php index 7e51974b..593918b3 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,7 @@ -GitHub: https://github.com/skiy-dockerfile/nginx-php7
-Docker Hub: https://hub.docker.com/r/skiychan/nginx-php7
+ Date: Fri, 4 Mar 2016 09:02:58 +0800 Subject: [PATCH 32/67] update php to version 7.0.4 --- Dockerfile | 4 ++-- README.md | 22 ++-------------------- changelogs.md | 21 +++++++++++++++++++++ 3 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 changelogs.md diff --git a/Dockerfile b/Dockerfile index bc920039..58670b83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,12 +2,12 @@ FROM centos:7 MAINTAINER Skiychan ## # Nginx: 1.9.12 -# PHP : 7.0.3 +# PHP : 7.0.4 ## #Install system library #RUN yum update -y -ENV PHP_VERSION 7.0.3 +ENV PHP_VERSION 7.0.4 ENV NGINX_VERSION 1.9.12 RUN yum install -y gcc \ diff --git a/README.md b/README.md index 3ed8fe59..454fcd5c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Nginx and PHP for Docker ## Version nginx: **1.9.12** -php: **7.0.3** +php: **7.0.4** ## 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. @@ -45,25 +45,7 @@ skiychan/nginx-php7 docker run --name nginx -p 8080:80 -d -v /your_php_extension:/usr/local/php/etc/php.d skiychan/nginx-php7 ``` -## ChangeLog -**2016 / 02 / 29:** -Update nginx to version 1.9.12 - -**2016 / 02 / 13:** -Update nginx to version 1.9.11 - -**2016 / 02 / 04:** -Update php to version 7.0.3 - -**2016 / 01 / 29:** -Add fileinfo support -Add ipv6 support - -**2016 / 01 / 27:** -Update nginx to version 1.9.10 - -**2016 / 01 / 25:** -Add xdebug support +## [ChangeLog](changelogs.md) ## Author diff --git a/changelogs.md b/changelogs.md new file mode 100644 index 00000000..c61a1dee --- /dev/null +++ b/changelogs.md @@ -0,0 +1,21 @@ +**2016 / 03 / 04:** +Update php to version 7.0.4 + +**2016 / 02 / 29:** +Update nginx to version 1.9.12 + +**2016 / 02 / 13:** +Update nginx to version 1.9.11 + +**2016 / 02 / 04:** +Update php to version 7.0.3 + +**2016 / 01 / 29:** +Add fileinfo support +Add ipv6 support + +**2016 / 01 / 27:** +Update nginx to version 1.9.10 + +**2016 / 01 / 25:** +Add xdebug support \ No newline at end of file From cf9624f7aaa9da12bac9c771cb6d34ba66804083 Mon Sep 17 00:00:00 2001 From: skiy Date: Thu, 31 Mar 2016 22:16:46 +0800 Subject: [PATCH 33/67] update php version to 7.0.5 --- Dockerfile | 6 +++--- changelogs.md | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 58670b83..6a8d851a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,12 +2,12 @@ FROM centos:7 MAINTAINER Skiychan ## # Nginx: 1.9.12 -# PHP : 7.0.4 +# PHP : 7.0.5 ## #Install system library #RUN yum update -y -ENV PHP_VERSION 7.0.4 +ENV PHP_VERSION 7.0.5 ENV NGINX_VERSION 1.9.12 RUN yum install -y gcc \ @@ -42,7 +42,7 @@ RUN rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch #Add user RUN groupadd -r www && \ - useradd -M -s /sbin/nologin -r -g www www + useradd -M -s /sbin/nologin -r -g www www #Download nginx & php RUN mkdir -p /home/nginx-php && cd $_ && \ diff --git a/changelogs.md b/changelogs.md index c61a1dee..6c6b66da 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,3 +1,6 @@ +**2016 / 03 / 31:** +Update php to version 7.0.5 + **2016 / 03 / 04:** Update php to version 7.0.4 @@ -16,6 +19,6 @@ Add ipv6 support **2016 / 01 / 27:** Update nginx to version 1.9.10 - + **2016 / 01 / 25:** -Add xdebug support \ No newline at end of file +Add xdebug support From 2ea6318aab4cbed345740180ef6a3e341dbe3ff4 Mon Sep 17 00:00:00 2001 From: skiy Date: Thu, 31 Mar 2016 23:34:13 +0800 Subject: [PATCH 34/67] update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 454fcd5c..326c1e2b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ Nginx and PHP for Docker -## Version +## Last Version nginx: **1.9.12** -php: **7.0.4** +php: **7.0.5** ## 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. From b558e390154d939cd2ac49ce048230d806016f49 Mon Sep 17 00:00:00 2001 From: skiy Date: Fri, 1 Apr 2016 12:52:52 +0800 Subject: [PATCH 35/67] Update PHP to version 7.0.5 Update nginx version to 1.9.13 Update XDEBUG remote support --- Dockerfile | 4 ++-- README.md | 4 ++-- changelogs.md | 6 ++++-- xdebug.ini | 9 ++++++++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6a8d851a..0dff0202 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ FROM centos:7 MAINTAINER Skiychan ## -# Nginx: 1.9.12 +# Nginx: 1.9.13 # PHP : 7.0.5 ## #Install system library #RUN yum update -y ENV PHP_VERSION 7.0.5 -ENV NGINX_VERSION 1.9.12 +ENV NGINX_VERSION 1.9.13 RUN yum install -y gcc \ gcc-c++ \ diff --git a/README.md b/README.md index 454fcd5c..5c299483 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Nginx and PHP for Docker -## Version -nginx: **1.9.12** +## Last Version +nginx: **1.9.13** php: **7.0.4** ## Installation diff --git a/changelogs.md b/changelogs.md index 6c6b66da..2f3f9bec 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,5 +1,7 @@ -**2016 / 03 / 31:** -Update php to version 7.0.5 +**2016 / 04 / 01:** +Update php to version 7.0.5 +Update nginx to version 1.9.13 +Update xdebug info **2016 / 03 / 04:** Update php to version 7.0.4 diff --git a/xdebug.ini b/xdebug.ini index 129b9638..660b0fd1 100644 --- a/xdebug.ini +++ b/xdebug.ini @@ -1 +1,8 @@ -extension=/usr/local/php/lib/php/extensions/xdebug.so \ No newline at end of file +[xdebug] +zend_extension = "/usr/local/php/lib/php/extensions/xdebug.so" +xdebug.remote_enable = On +xdebug.profiler_enable = On +xdebug.profiler_enable_trigger = On +xdebug.remote_handler = dbgp +xdebug.remote_host = localhost +xdebug.remote_port = 9001 From 3f18387f9ed57133224e016fceb966e6c4148eb9 Mon Sep 17 00:00:00 2001 From: skiy Date: Fri, 1 Apr 2016 13:40:48 +0800 Subject: [PATCH 36/67] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c299483..7706eb22 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Nginx and PHP for Docker ## Last Version nginx: **1.9.13** -php: **7.0.4** +php: **7.0.5** ## 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. From 3785eb078e29b6c6a636c83c85b71f1f388b42ce Mon Sep 17 00:00:00 2001 From: skiy Date: Fri, 1 Apr 2016 13:49:03 +0800 Subject: [PATCH 37/67] update --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index a9df7f06..7706eb22 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,7 @@ Nginx and PHP for Docker ## Last Version -<<<<<<< HEAD -nginx: **1.9.12** -======= nginx: **1.9.13** ->>>>>>> develop php: **7.0.5** ## Installation From 0b432dd6f961166b1c89a4595c420ce30cbef4b0 Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 6 Apr 2016 15:15:34 +0800 Subject: [PATCH 38/67] update nginx to version 1.9.14 --- README.md | 2 +- changelogs.md | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7706eb22..7434b5e7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Nginx and PHP for Docker ## Last Version -nginx: **1.9.13** +nginx: **1.9.14** php: **7.0.5** ## Installation diff --git a/changelogs.md b/changelogs.md index 2f3f9bec..7f60cc6b 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,16 +1,19 @@ +**2016 / 04 / 06:** +Update nginx to version 1.9.14 + **2016 / 04 / 01:** Update php to version 7.0.5 -Update nginx to version 1.9.13 -Update xdebug info +Update nginx to version 1.9.13 +Update xdebug info **2016 / 03 / 04:** -Update php to version 7.0.4 +Update php to version 7.0.4 **2016 / 02 / 29:** -Update nginx to version 1.9.12 +Update nginx to version 1.9.12 **2016 / 02 / 13:** -Update nginx to version 1.9.11 +Update nginx to version 1.9.11 **2016 / 02 / 04:** Update php to version 7.0.3 @@ -20,7 +23,7 @@ Add fileinfo support Add ipv6 support **2016 / 01 / 27:** -Update nginx to version 1.9.10 +Update nginx to version 1.9.10 **2016 / 01 / 25:** -Add xdebug support +Add xdebug support From acdbbe92fd379d9e28c8595a2d4e76d770a060ef Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 6 Apr 2016 15:23:42 +0800 Subject: [PATCH 39/67] update dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0dff0202..43dea69d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ FROM centos:7 MAINTAINER Skiychan ## -# Nginx: 1.9.13 +# Nginx: 1.9.14 # PHP : 7.0.5 ## #Install system library #RUN yum update -y ENV PHP_VERSION 7.0.5 -ENV NGINX_VERSION 1.9.13 +ENV NGINX_VERSION 1.9.14 RUN yum install -y gcc \ gcc-c++ \ From 709c8645c653a5f4e15366759c318f4a46d0c351 Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 20 Apr 2016 21:37:50 +0800 Subject: [PATCH 40/67] update nginx to version 1.9.15 --- .DS_Store | Bin 0 -> 6148 bytes Dockerfile | 4 ++-- README.md | 2 +- changelogs.md | 3 +++ 4 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..4ad1d26857ba258be8a6f9940c4da242042ed5ca GIT binary patch literal 6148 zcmeHK%TB{E5FDqKXv3vPjyZCw#2{6z)i z>|$i7P~eHDwm-k?vMTbj%Gob3#})nj(;90)m#4hMn2cBSvBDgyfbkYEV#d!bOBe-b zTw>bfm{Gv#VuT?sxxO1>AI}&EjQ4=i!3JAAa35R7Z!mAhM|VMdk1;#0Uv~b&)or-0 zHTQL7h0#aAkGX$QA?GMFvP6|dbI#Udz~Q5sDxeCe0>7#NbGBIL)S;HDfGVI0>=lsj zLqZo!J=PBGr-OyP0ubA5w#K^rE(#~{n0l-ovWI3ImFTF(UoniMvpw-~smI!(qr>>i zhw(ETe?u{Lc8;IeaG2Dgma2d%&{Ux19($7ihsW>#O_DyT0;<5jQoyvc+ibus`P_Q2 wImxvN{hlr+akaxeg%z8M87ryyjBbtXiByQG$J!xVX!;{yWza$u_)!JE0LVseVgLXD literal 0 HcmV?d00001 diff --git a/Dockerfile b/Dockerfile index 43dea69d..f5aa3a3c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ FROM centos:7 MAINTAINER Skiychan ## -# Nginx: 1.9.14 +# Nginx: 1.9.15 # PHP : 7.0.5 ## #Install system library #RUN yum update -y ENV PHP_VERSION 7.0.5 -ENV NGINX_VERSION 1.9.14 +ENV NGINX_VERSION 1.9.15 RUN yum install -y gcc \ gcc-c++ \ diff --git a/README.md b/README.md index 7434b5e7..b0b3b9e3 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Nginx and PHP for Docker ## Last Version -nginx: **1.9.14** +nginx: **1.9.15** php: **7.0.5** ## Installation diff --git a/changelogs.md b/changelogs.md index 7f60cc6b..9bb87ad2 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,3 +1,6 @@ +**2016 / 04 / 20:** +Update nginx to version 1.9.15 + **2016 / 04 / 06:** Update nginx to version 1.9.14 From 720dc32091ba76774c237d0407085179d62b2a4e Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 27 Apr 2016 09:05:19 +0800 Subject: [PATCH 41/67] update nginx to version 1.10 --- Dockerfile | 10 +-- Dockerfile~ | 163 +++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 +- README.md~ | 54 ++++++++++++++++ changelogs.md | 4 ++ changelogs.md~ | 26 ++++++++ xdebug.ini | 4 +- 7 files changed, 255 insertions(+), 8 deletions(-) create mode 100644 Dockerfile~ create mode 100644 README.md~ create mode 100644 changelogs.md~ diff --git a/Dockerfile b/Dockerfile index f5aa3a3c..32844427 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ FROM centos:7 MAINTAINER Skiychan ## -# Nginx: 1.9.15 +# Nginx: 1.10 # PHP : 7.0.5 ## #Install system library #RUN yum update -y +ENV NGINX_VERSION 1.10 ENV PHP_VERSION 7.0.5 -ENV NGINX_VERSION 1.9.15 RUN yum install -y gcc \ gcc-c++ \ @@ -121,9 +121,9 @@ RUN cd /home/nginx-php && \ /usr/local/php/bin/phpize && \ ./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config && \ make && \ - cp modules/xdebug.so /usr/local/php/lib/php/extensions/xdebug.so + cp modules/xdebug.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20151012/ -RUN cd /home/nginx-php/php-$PHP_VERSION && \ +RUN 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 @@ -154,7 +154,7 @@ ADD start.sh /start.sh RUN chmod +x /start.sh #Set port -EXPOSE 80 443 9000 +EXPOSE 80 443 9999 #Start it ENTRYPOINT ["/start.sh"] diff --git a/Dockerfile~ b/Dockerfile~ new file mode 100644 index 00000000..0dff0202 --- /dev/null +++ b/Dockerfile~ @@ -0,0 +1,163 @@ +FROM centos:7 +MAINTAINER Skiychan +## +# Nginx: 1.9.13 +# PHP : 7.0.5 +## +#Install system library +#RUN yum update -y + +ENV PHP_VERSION 7.0.5 +ENV NGINX_VERSION 1.9.13 + +RUN yum install -y gcc \ + gcc-c++ \ + autoconf \ + automake \ + libtool \ + make \ + cmake && \ + yum clean all + +#Install PHP library +## libmcrypt-devel DIY +RUN rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm && \ + yum install -y wget \ + 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 && \ + yum clean all + +#Add user +RUN groupadd -r www && \ + useradd -M -s /sbin/nologin -r -g www www + +#Download nginx & php +RUN mkdir -p /home/nginx-php && cd $_ && \ + wget -c -O nginx.tar.gz http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && \ + wget -O php.tar.gz http://php.net/distributions/php-$PHP_VERSION.tar.gz && \ + curl -O -SL https://github.com/xdebug/xdebug/archive/XDEBUG_2_4_0RC3.tar.gz + +#Make install nginx +RUN cd /home/nginx-php && \ + tar -zxvf nginx.tar.gz && \ + cd 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 +RUN cd /home/nginx-php && \ + tar zvxf php.tar.gz && \ + cd 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 + +#Add xdebug extension +RUN cd /home/nginx-php && \ + tar -zxvf XDEBUG_2_4_0RC3.tar.gz && \ + cd xdebug-XDEBUG_2_4_0RC3 && \ + /usr/local/php/bin/phpize && \ + ./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config && \ + make && \ + cp modules/xdebug.so /usr/local/php/lib/php/extensions/xdebug.so + +RUN 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 +RUN easy_install supervisor && \ + mkdir -p /var/log/supervisor && \ + mkdir -p /var/run/sshd && \ + mkdir -p /var/run/supervisord + +#Add supervisord conf +ADD supervisord.conf /etc/supervisord.conf + +#Remove zips +RUN cd / && rm -rf /home/nginx-php + +#Create web folder +VOLUME ["/data/www", "/usr/local/nginx/conf/ssl", "/usr/local/nginx/conf/vhost", "/usr/local/php/etc/php.d"] +ADD index.php /data/www/index.php + +ADD xdebug.ini /usr/local/php/etc/php.d/xdebug.ini + +#Update nginx config +ADD nginx.conf /usr/local/nginx/conf/nginx.conf + +#Start +ADD start.sh /start.sh +RUN chmod +x /start.sh + +#Set port +EXPOSE 80 443 9000 + +#Start it +ENTRYPOINT ["/start.sh"] + +#Start web server +#CMD ["/bin/bash", "/start.sh"] diff --git a/README.md b/README.md index b0b3b9e3..150542f7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Nginx and PHP for Docker ## Last Version -nginx: **1.9.15** +nginx: **1.10** php: **7.0.5** ## Installation diff --git a/README.md~ b/README.md~ new file mode 100644 index 00000000..7706eb22 --- /dev/null +++ b/README.md~ @@ -0,0 +1,54 @@ +Nginx and PHP for Docker + +## Last Version +nginx: **1.9.13** +php: **7.0.5** + +## 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 +``` + +To pull the Nightly Version: +``` +docker pull skiychan/nginx-php7:nightly +``` + +## Running +To simply run the container: +```sh +docker run --name nginx -p 8080:80 -d skiychan/nginx-php7 +``` +You can then browse to http://\:8080 to view the default install files. + +## Volumes +If you want to link to your web site directory on the docker host to the container run: +```sh +docker run --name nginx -p 8080:80 -v /your_code_directory:/data/www -d skiychan/nginx-php7 +``` + +## Enabling SSL +```sh +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 +``` + +## Enabling Extensions +```sh +docker run --name nginx -p 8080:80 -d -v /your_php_extension:/usr/local/php/etc/php.d skiychan/nginx-php7 +``` + +## [ChangeLog](changelogs.md) + + +## Author +Author: Skiychan +Email: dev@skiy.net +Link: https://www.zzzzy.com diff --git a/changelogs.md b/changelogs.md index 9bb87ad2..9a01259e 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,3 +1,7 @@ +**2016 / 04 / 27:** +Update nginx to version 1.10 +Fix xdebug port to 9999 + **2016 / 04 / 20:** Update nginx to version 1.9.15 diff --git a/changelogs.md~ b/changelogs.md~ new file mode 100644 index 00000000..2f3f9bec --- /dev/null +++ b/changelogs.md~ @@ -0,0 +1,26 @@ +**2016 / 04 / 01:** +Update php to version 7.0.5 +Update nginx to version 1.9.13 +Update xdebug info + +**2016 / 03 / 04:** +Update php to version 7.0.4 + +**2016 / 02 / 29:** +Update nginx to version 1.9.12 + +**2016 / 02 / 13:** +Update nginx to version 1.9.11 + +**2016 / 02 / 04:** +Update php to version 7.0.3 + +**2016 / 01 / 29:** +Add fileinfo support +Add ipv6 support + +**2016 / 01 / 27:** +Update nginx to version 1.9.10 + +**2016 / 01 / 25:** +Add xdebug support diff --git a/xdebug.ini b/xdebug.ini index 660b0fd1..bbb9ff38 100644 --- a/xdebug.ini +++ b/xdebug.ini @@ -1,8 +1,8 @@ [xdebug] -zend_extension = "/usr/local/php/lib/php/extensions/xdebug.so" +zend_extension = xdebug.so xdebug.remote_enable = On xdebug.profiler_enable = On xdebug.profiler_enable_trigger = On xdebug.remote_handler = dbgp xdebug.remote_host = localhost -xdebug.remote_port = 9001 +xdebug.remote_port = 9999 From 549c408694c9d8619b4b6f4f44d23ce168d9b328 Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 27 Apr 2016 09:09:58 +0800 Subject: [PATCH 42/67] remove vi backed files --- .DS_Store | Bin 6148 -> 0 bytes .gitignore | 3 + Dockerfile~ | 163 ------------------------------------------------- README.md~ | 54 ---------------- changelogs.md~ | 26 -------- 5 files changed, 3 insertions(+), 243 deletions(-) delete mode 100644 .DS_Store create mode 100644 .gitignore delete mode 100644 Dockerfile~ delete mode 100644 README.md~ delete mode 100644 changelogs.md~ diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 4ad1d26857ba258be8a6f9940c4da242042ed5ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%TB{E5FDqKXv3vPjyZCw#2{6z)i z>|$i7P~eHDwm-k?vMTbj%Gob3#})nj(;90)m#4hMn2cBSvBDgyfbkYEV#d!bOBe-b zTw>bfm{Gv#VuT?sxxO1>AI}&EjQ4=i!3JAAa35R7Z!mAhM|VMdk1;#0Uv~b&)or-0 zHTQL7h0#aAkGX$QA?GMFvP6|dbI#Udz~Q5sDxeCe0>7#NbGBIL)S;HDfGVI0>=lsj zLqZo!J=PBGr-OyP0ubA5w#K^rE(#~{n0l-ovWI3ImFTF(UoniMvpw-~smI!(qr>>i zhw(ETe?u{Lc8;IeaG2Dgma2d%&{Ux19($7ihsW>#O_DyT0;<5jQoyvc+ibus`P_Q2 wImxvN{hlr+akaxeg%z8M87ryyjBbtXiByQG$J!xVX!;{yWza$u_)!JE0LVseVgLXD diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..d58b0de0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.*~ +.swp +.DS_Store diff --git a/Dockerfile~ b/Dockerfile~ deleted file mode 100644 index 0dff0202..00000000 --- a/Dockerfile~ +++ /dev/null @@ -1,163 +0,0 @@ -FROM centos:7 -MAINTAINER Skiychan -## -# Nginx: 1.9.13 -# PHP : 7.0.5 -## -#Install system library -#RUN yum update -y - -ENV PHP_VERSION 7.0.5 -ENV NGINX_VERSION 1.9.13 - -RUN yum install -y gcc \ - gcc-c++ \ - autoconf \ - automake \ - libtool \ - make \ - cmake && \ - yum clean all - -#Install PHP library -## libmcrypt-devel DIY -RUN rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm && \ - yum install -y wget \ - 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 && \ - yum clean all - -#Add user -RUN groupadd -r www && \ - useradd -M -s /sbin/nologin -r -g www www - -#Download nginx & php -RUN mkdir -p /home/nginx-php && cd $_ && \ - wget -c -O nginx.tar.gz http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && \ - wget -O php.tar.gz http://php.net/distributions/php-$PHP_VERSION.tar.gz && \ - curl -O -SL https://github.com/xdebug/xdebug/archive/XDEBUG_2_4_0RC3.tar.gz - -#Make install nginx -RUN cd /home/nginx-php && \ - tar -zxvf nginx.tar.gz && \ - cd 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 -RUN cd /home/nginx-php && \ - tar zvxf php.tar.gz && \ - cd 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 - -#Add xdebug extension -RUN cd /home/nginx-php && \ - tar -zxvf XDEBUG_2_4_0RC3.tar.gz && \ - cd xdebug-XDEBUG_2_4_0RC3 && \ - /usr/local/php/bin/phpize && \ - ./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config && \ - make && \ - cp modules/xdebug.so /usr/local/php/lib/php/extensions/xdebug.so - -RUN 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 -RUN easy_install supervisor && \ - mkdir -p /var/log/supervisor && \ - mkdir -p /var/run/sshd && \ - mkdir -p /var/run/supervisord - -#Add supervisord conf -ADD supervisord.conf /etc/supervisord.conf - -#Remove zips -RUN cd / && rm -rf /home/nginx-php - -#Create web folder -VOLUME ["/data/www", "/usr/local/nginx/conf/ssl", "/usr/local/nginx/conf/vhost", "/usr/local/php/etc/php.d"] -ADD index.php /data/www/index.php - -ADD xdebug.ini /usr/local/php/etc/php.d/xdebug.ini - -#Update nginx config -ADD nginx.conf /usr/local/nginx/conf/nginx.conf - -#Start -ADD start.sh /start.sh -RUN chmod +x /start.sh - -#Set port -EXPOSE 80 443 9000 - -#Start it -ENTRYPOINT ["/start.sh"] - -#Start web server -#CMD ["/bin/bash", "/start.sh"] diff --git a/README.md~ b/README.md~ deleted file mode 100644 index 7706eb22..00000000 --- a/README.md~ +++ /dev/null @@ -1,54 +0,0 @@ -Nginx and PHP for Docker - -## Last Version -nginx: **1.9.13** -php: **7.0.5** - -## 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 -``` - -To pull the Nightly Version: -``` -docker pull skiychan/nginx-php7:nightly -``` - -## Running -To simply run the container: -```sh -docker run --name nginx -p 8080:80 -d skiychan/nginx-php7 -``` -You can then browse to http://\:8080 to view the default install files. - -## Volumes -If you want to link to your web site directory on the docker host to the container run: -```sh -docker run --name nginx -p 8080:80 -v /your_code_directory:/data/www -d skiychan/nginx-php7 -``` - -## Enabling SSL -```sh -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 -``` - -## Enabling Extensions -```sh -docker run --name nginx -p 8080:80 -d -v /your_php_extension:/usr/local/php/etc/php.d skiychan/nginx-php7 -``` - -## [ChangeLog](changelogs.md) - - -## Author -Author: Skiychan -Email: dev@skiy.net -Link: https://www.zzzzy.com diff --git a/changelogs.md~ b/changelogs.md~ deleted file mode 100644 index 2f3f9bec..00000000 --- a/changelogs.md~ +++ /dev/null @@ -1,26 +0,0 @@ -**2016 / 04 / 01:** -Update php to version 7.0.5 -Update nginx to version 1.9.13 -Update xdebug info - -**2016 / 03 / 04:** -Update php to version 7.0.4 - -**2016 / 02 / 29:** -Update nginx to version 1.9.12 - -**2016 / 02 / 13:** -Update nginx to version 1.9.11 - -**2016 / 02 / 04:** -Update php to version 7.0.3 - -**2016 / 01 / 29:** -Add fileinfo support -Add ipv6 support - -**2016 / 01 / 27:** -Update nginx to version 1.9.10 - -**2016 / 01 / 25:** -Add xdebug support From b55b8b954314b1ac77ac3eca4da546fd30b65bbf Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 27 Apr 2016 09:11:45 +0800 Subject: [PATCH 43/67] fix nginx version number --- Dockerfile | 4 ++-- README.md | 2 +- changelogs.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 32844427..dc8257ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,13 @@ FROM centos:7 MAINTAINER Skiychan ## -# Nginx: 1.10 +# Nginx: 1.10.0 # PHP : 7.0.5 ## #Install system library #RUN yum update -y -ENV NGINX_VERSION 1.10 +ENV NGINX_VERSION 1.10.0 ENV PHP_VERSION 7.0.5 RUN yum install -y gcc \ diff --git a/README.md b/README.md index 150542f7..2c6625e6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Nginx and PHP for Docker ## Last Version -nginx: **1.10** +nginx: **1.10.0** php: **7.0.5** ## Installation diff --git a/changelogs.md b/changelogs.md index 9a01259e..d43d7b0e 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,5 +1,5 @@ **2016 / 04 / 27:** -Update nginx to version 1.10 +Update nginx to version 1.10.0 Fix xdebug port to 9999 **2016 / 04 / 20:** From 8857eefc2333c6624b7a0085f08b97d54cc3684b Mon Sep 17 00:00:00 2001 From: skiy Date: Thu, 28 Apr 2016 13:43:50 +0800 Subject: [PATCH 44/67] upgrade php to version 7.0.6 --- Dockerfile | 4 ++-- README.md | 2 +- changelogs.md | 33 ++++++++++++++++++--------------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index dc8257ea..24ad3674 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,13 +2,13 @@ FROM centos:7 MAINTAINER Skiychan ## # Nginx: 1.10.0 -# PHP : 7.0.5 +# PHP : 7.0.6 ## #Install system library #RUN yum update -y ENV NGINX_VERSION 1.10.0 -ENV PHP_VERSION 7.0.5 +ENV PHP_VERSION 7.0.6 RUN yum install -y gcc \ gcc-c++ \ diff --git a/README.md b/README.md index 2c6625e6..2506c0ce 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Nginx and PHP for Docker ## Last Version nginx: **1.10.0** -php: **7.0.5** +php: **7.0.6** ## 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. diff --git a/changelogs.md b/changelogs.md index d43d7b0e..6ce68166 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,36 +1,39 @@ +**2016 / 04 / 28:** +upgrade php to version 7.0.6 + **2016 / 04 / 27:** -Update nginx to version 1.10.0 -Fix xdebug port to 9999 +upgrade nginx to version 1.10.0 +update xdebug port to 9999 **2016 / 04 / 20:** -Update nginx to version 1.9.15 +upgrade nginx to version 1.9.15 **2016 / 04 / 06:** -Update nginx to version 1.9.14 +upgrade nginx to version 1.9.14 **2016 / 04 / 01:** -Update php to version 7.0.5 -Update nginx to version 1.9.13 -Update xdebug info +upgrade php to version 7.0.5 +upgrade nginx to version 1.9.13 +upgrade xdebug info **2016 / 03 / 04:** -Update php to version 7.0.4 +upgrade php to version 7.0.4 **2016 / 02 / 29:** -Update nginx to version 1.9.12 +upgrade nginx to version 1.9.12 **2016 / 02 / 13:** -Update nginx to version 1.9.11 +upgrade nginx to version 1.9.11 **2016 / 02 / 04:** -Update php to version 7.0.3 +upgrade php to version 7.0.3 **2016 / 01 / 29:** -Add fileinfo support -Add ipv6 support +add fileinfo support +add ipv6 support **2016 / 01 / 27:** -Update nginx to version 1.9.10 +upgrade nginx to version 1.9.10 **2016 / 01 / 25:** -Add xdebug support +add xdebug support From 4726f62c1c38132f9a1a3da06bd9bb6070f56cf6 Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 4 May 2016 14:53:51 +0800 Subject: [PATCH 45/67] fix xdebug --- xdebug.ini | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/xdebug.ini b/xdebug.ini index bbb9ff38..2c9f84cd 100644 --- a/xdebug.ini +++ b/xdebug.ini @@ -1,8 +1,12 @@ [xdebug] zend_extension = xdebug.so -xdebug.remote_enable = On -xdebug.profiler_enable = On -xdebug.profiler_enable_trigger = On -xdebug.remote_handler = dbgp -xdebug.remote_host = localhost -xdebug.remote_port = 9999 +xdebug.remote_enable = 1; +xdebug.remote_connect_back = 1; +xdebug.remote_port = 9001; +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; + From 6fd6a83f232ba20ee0d65cc116d29c8224eb218e Mon Sep 17 00:00:00 2001 From: skiy Date: Fri, 6 May 2016 09:10:32 +0800 Subject: [PATCH 46/67] fix php-start alway --- Dockerfile | 2 +- start.sh | 1 - supervisord.conf | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 24ad3674..a4b55f03 100644 --- a/Dockerfile +++ b/Dockerfile @@ -154,7 +154,7 @@ ADD start.sh /start.sh RUN chmod +x /start.sh #Set port -EXPOSE 80 443 9999 +EXPOSE 80 443 9001 #Start it ENTRYPOINT ["/start.sh"] diff --git a/start.sh b/start.sh index 66e9efd2..f50c82ff 100644 --- a/start.sh +++ b/start.sh @@ -10,7 +10,6 @@ Nginx_Install_Dir=/usr/local/nginx DATA_DIR=/data/www set -e - chown -R www.www $DATA_DIR if [[ -n "$PROXY_WEB" ]]; then diff --git a/supervisord.conf b/supervisord.conf index 8fc30243..f3003263 100644 --- a/supervisord.conf +++ b/supervisord.conf @@ -22,7 +22,7 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket [program:php-fpm] -command=/usr/local/php/sbin/php-fpm +command=/usr/local/php/sbin/php-fpm -F autostart=true autorestart=true priority=5 From 08c5d33d4b6db2f317f3894e369bb69ae2a81728 Mon Sep 17 00:00:00 2001 From: skiy Date: Fri, 6 May 2016 09:29:36 +0800 Subject: [PATCH 47/67] fixbug php-fpm repeated start update xdebug port to 9001 --- changelogs.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelogs.md b/changelogs.md index 6ce68166..bcfa43b3 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,3 +1,7 @@ +**2016 / 05 / 06:** +fixbug php-fpm repeated start +update xdebug port to 9001 + **2016 / 04 / 28:** upgrade php to version 7.0.6 From f88ee65f49f60fbeb0704b714374112c4c4a4f7a Mon Sep 17 00:00:00 2001 From: skiy Date: Thu, 26 May 2016 13:44:36 +0800 Subject: [PATCH 48/67] upgrade nginx to version 1.11.0 upgrade php to version 7.0.7 remove xdebug port --- Dockerfile | 13 ++++--------- README.md | 7 +++++-- changelogs.md | 5 +++++ xdebug.ini | 21 +++++++++++---------- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index a4b55f03..cd5959d4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,8 @@ FROM centos:7 MAINTAINER Skiychan -## -# Nginx: 1.10.0 -# PHP : 7.0.6 -## -#Install system library -#RUN yum update -y -ENV NGINX_VERSION 1.10.0 -ENV PHP_VERSION 7.0.6 +ENV NGINX_VERSION 1.11.0 +ENV PHP_VERSION 7.0.7 RUN yum install -y gcc \ gcc-c++ \ @@ -142,6 +136,7 @@ RUN cd / && rm -rf /home/nginx-php #Create web folder VOLUME ["/data/www", "/usr/local/nginx/conf/ssl", "/usr/local/nginx/conf/vhost", "/usr/local/php/etc/php.d"] +RUN chmod -R www:www /data/www ADD index.php /data/www/index.php ADD xdebug.ini /usr/local/php/etc/php.d/xdebug.ini @@ -154,7 +149,7 @@ ADD start.sh /start.sh RUN chmod +x /start.sh #Set port -EXPOSE 80 443 9001 +EXPOSE 80 443 #Start it ENTRYPOINT ["/start.sh"] diff --git a/README.md b/README.md index 2506c0ce..67ce0776 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,12 @@ Nginx and PHP for Docker ## Last Version -nginx: **1.10.0** -php: **7.0.6** +nginx: **1.11.0** +php: **7.0.7** +## 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 diff --git a/changelogs.md b/changelogs.md index bcfa43b3..961c3a42 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,3 +1,8 @@ +**2016 / 05 / 26:** +remove xdebug port +upgrade php to version 7.0.7 +upgrade nginx to version 1.11.0 + **2016 / 05 / 06:** fixbug php-fpm repeated start update xdebug port to 9001 diff --git a/xdebug.ini b/xdebug.ini index 2c9f84cd..29d9eff9 100644 --- a/xdebug.ini +++ b/xdebug.ini @@ -1,12 +1,13 @@ [xdebug] -zend_extension = xdebug.so -xdebug.remote_enable = 1; -xdebug.remote_connect_back = 1; -xdebug.remote_port = 9001; -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; +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; From ceedbcdd89c3ab33a9a1b65f5651492f5ca7e756 Mon Sep 17 00:00:00 2001 From: skiy Date: Thu, 26 May 2016 14:10:25 +0800 Subject: [PATCH 49/67] fix --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cd5959d4..b83b517b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -136,7 +136,7 @@ RUN cd / && rm -rf /home/nginx-php #Create web folder VOLUME ["/data/www", "/usr/local/nginx/conf/ssl", "/usr/local/nginx/conf/vhost", "/usr/local/php/etc/php.d"] -RUN chmod -R www:www /data/www +RUN chown -R www:www /data/www ADD index.php /data/www/index.php ADD xdebug.ini /usr/local/php/etc/php.d/xdebug.ini From dc1479509879a5815cef79c091e21d285752fcff Mon Sep 17 00:00:00 2001 From: skiy Date: Thu, 2 Jun 2016 09:10:58 +0800 Subject: [PATCH 50/67] upgrade nginx to version 1.11.1 --- Dockerfile | 2 +- README.md | 2 +- changelogs.md | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b83b517b..571d87e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM centos:7 MAINTAINER Skiychan -ENV NGINX_VERSION 1.11.0 +ENV NGINX_VERSION 1.11.1 ENV PHP_VERSION 7.0.7 RUN yum install -y gcc \ diff --git a/README.md b/README.md index 67ce0776..0d21d9d3 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Nginx and PHP for Docker ## Last Version -nginx: **1.11.0** +nginx: **1.11.1** php: **7.0.7** ## Docker Hub diff --git a/changelogs.md b/changelogs.md index 961c3a42..4e5679b7 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,3 +1,6 @@ +**2016 / 06 / 02:** +upgrade nginx to version 1.11.1 + **2016 / 05 / 26:** remove xdebug port upgrade php to version 7.0.7 From 609e65d8e5dc5720429fb6d76790c9c8d4916a86 Mon Sep 17 00:00:00 2001 From: skiy Date: Thu, 23 Jun 2016 14:44:42 +0800 Subject: [PATCH 51/67] upgrade php to version 7.0.8 --- Dockerfile | 2 +- README.md | 2 +- changelogs.md | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 571d87e4..572a0765 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM centos:7 MAINTAINER Skiychan ENV NGINX_VERSION 1.11.1 -ENV PHP_VERSION 7.0.7 +ENV PHP_VERSION 7.0.8 RUN yum install -y gcc \ gcc-c++ \ diff --git a/README.md b/README.md index 0d21d9d3..19857ad1 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Nginx and PHP for Docker ## Last Version nginx: **1.11.1** -php: **7.0.7** +php: **7.0.8** ## Docker Hub **Nginx-PHP7:** [https://hub.docker.com/r/skiychan/nginx-php7](https://hub.docker.com/r/skiychan/nginx-php7) diff --git a/changelogs.md b/changelogs.md index 4e5679b7..fa2e245b 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,3 +1,6 @@ +**2016 / 06 / 23:** +upgrade php to version 7.0.8 + **2016 / 06 / 02:** upgrade nginx to version 1.11.1 From 911a03ddbe35b42189c0f38d0a060dfd953ad2f6 Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 6 Jul 2016 11:23:53 +0800 Subject: [PATCH 52/67] upgrade nginx to version 1.11.2 --- Dockerfile | 2 +- README.md | 2 +- changelogs.md | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 572a0765..6f3622ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM centos:7 MAINTAINER Skiychan -ENV NGINX_VERSION 1.11.1 +ENV NGINX_VERSION 1.11.2 ENV PHP_VERSION 7.0.8 RUN yum install -y gcc \ diff --git a/README.md b/README.md index 19857ad1..f70a3b7e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Nginx and PHP for Docker ## Last Version -nginx: **1.11.1** +nginx: **1.11.22** php: **7.0.8** ## Docker Hub diff --git a/changelogs.md b/changelogs.md index fa2e245b..d67ef01c 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,3 +1,6 @@ +**2016 / 07 / 5:** +upgrade nginx to version 1.11.2 + **2016 / 06 / 23:** upgrade php to version 7.0.8 From 3c834668b69adc8b819d4024d719dc9af0ce03a4 Mon Sep 17 00:00:00 2001 From: skiy Date: Fri, 22 Jul 2016 17:28:45 +0800 Subject: [PATCH 53/67] update php to version 7.0.9 --- Dockerfile | 2 +- README.md | 2 +- changelogs.md | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6f3622ce..54cae344 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM centos:7 MAINTAINER Skiychan ENV NGINX_VERSION 1.11.2 -ENV PHP_VERSION 7.0.8 +ENV PHP_VERSION 7.0.9 RUN yum install -y gcc \ gcc-c++ \ diff --git a/README.md b/README.md index f70a3b7e..b8f25892 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Nginx and PHP for Docker ## Last Version nginx: **1.11.22** -php: **7.0.8** +php: **7.0.9** ## Docker Hub **Nginx-PHP7:** [https://hub.docker.com/r/skiychan/nginx-php7](https://hub.docker.com/r/skiychan/nginx-php7) diff --git a/changelogs.md b/changelogs.md index d67ef01c..0f26abf9 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,4 +1,7 @@ -**2016 / 07 / 5:** +**2016 / 07 / 22:** +upgrade php to version 7.0.9 + +**2016 / 07 / 05:** upgrade nginx to version 1.11.2 **2016 / 06 / 23:** From 1534b3f7f1e438813208fa43423b3e09b42f104f Mon Sep 17 00:00:00 2001 From: skiy Date: Tue, 2 Aug 2016 16:30:54 +0800 Subject: [PATCH 54/67] update --- Dockerfile | 2 +- README.md | 2 +- changelogs.md | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 54cae344..1cac64fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM centos:7 MAINTAINER Skiychan -ENV NGINX_VERSION 1.11.2 +ENV NGINX_VERSION 1.11.3 ENV PHP_VERSION 7.0.9 RUN yum install -y gcc \ diff --git a/README.md b/README.md index b8f25892..47dcb29c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Nginx and PHP for Docker ## Last Version -nginx: **1.11.22** +nginx: **1.11.3** php: **7.0.9** ## Docker Hub diff --git a/changelogs.md b/changelogs.md index 0f26abf9..92d3afb8 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,3 +1,6 @@ +**2016 / 08 / 02:** +upgrade nginx to version 1.11.3 + **2016 / 07 / 22:** upgrade php to version 7.0.9 From eed0d37f2e0d64bb752ff1bce6f36f2020aac18c Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 3 Aug 2016 21:02:32 +0800 Subject: [PATCH 55/67] udpate --- Dockerfile | 20 ++++++-------------- xdebug.ini => ext/xdebug.ini | 0 extension.sh | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 14 deletions(-) rename xdebug.ini => ext/xdebug.ini (100%) create mode 100644 extension.sh diff --git a/Dockerfile b/Dockerfile index 1cac64fc..b5ad6a1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,7 +42,6 @@ RUN groupadd -r www && \ RUN mkdir -p /home/nginx-php && cd $_ && \ wget -c -O nginx.tar.gz http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && \ wget -O php.tar.gz http://php.net/distributions/php-$PHP_VERSION.tar.gz && \ - curl -O -SL https://github.com/xdebug/xdebug/archive/XDEBUG_2_4_0RC3.tar.gz #Make install nginx RUN cd /home/nginx-php && \ @@ -108,15 +107,8 @@ RUN cd /home/nginx-php && \ --without-pear && \ make && make install -#Add xdebug extension -RUN cd /home/nginx-php && \ - tar -zxvf XDEBUG_2_4_0RC3.tar.gz && \ - cd xdebug-XDEBUG_2_4_0RC3 && \ - /usr/local/php/bin/phpize && \ - ./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config && \ - make && \ - cp modules/xdebug.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20151012/ +#Install php-fpm RUN 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 && \ @@ -129,7 +121,7 @@ RUN easy_install supervisor && \ mkdir -p /var/run/supervisord #Add supervisord conf -ADD supervisord.conf /etc/supervisord.conf +ADD supervisord.conf /etc/ #Remove zips RUN cd / && rm -rf /home/nginx-php @@ -137,15 +129,15 @@ RUN cd / && rm -rf /home/nginx-php #Create web folder VOLUME ["/data/www", "/usr/local/nginx/conf/ssl", "/usr/local/nginx/conf/vhost", "/usr/local/php/etc/php.d"] RUN chown -R www:www /data/www -ADD index.php /data/www/index.php +ADD index.php /data/www/ -ADD xdebug.ini /usr/local/php/etc/php.d/xdebug.ini +ADD ext/ /usr/local/php/etc/php.d/ #Update nginx config -ADD nginx.conf /usr/local/nginx/conf/nginx.conf +ADD nginx.conf /usr/local/nginx/conf/ #Start -ADD start.sh /start.sh +ADD start.sh / RUN chmod +x /start.sh #Set port diff --git a/xdebug.ini b/ext/xdebug.ini similarity index 100% rename from xdebug.ini rename to ext/xdebug.ini diff --git a/extension.sh b/extension.sh new file mode 100644 index 00000000..df4388cc --- /dev/null +++ b/extension.sh @@ -0,0 +1,19 @@ +#!/bin/sh +######################################################################### +# File Name: extension.sh +# Author: Skiychan +# Email: dev@skiy.net +# Version: +# Created Time: 2016/08/03 +######################################################################### + +RUN mkdir -p /home/extension && cd $_ + +#Add xdebug extension +curl -O -SL https://github.com/xdebug/xdebug/archive/XDEBUG_2_4_0RC3.tar.gz && \ +tar -zxvf XDEBUG_2_4_0RC3.tar.gz && \ +cd xdebug-XDEBUG_2_4_0RC3 && \ +/usr/local/php/bin/phpize && \ +./configure --enable-xdebug --with-php-config=/usr/local/php/bin/php-config && \ +make && \ +cp modules/xdebug.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20151012/ \ No newline at end of file From 21942edb0d1e6ef1b155e93e64a39e0e7dc63eff Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 3 Aug 2016 21:28:17 +0800 Subject: [PATCH 56/67] update dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b5ad6a1a..c518c60a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,7 +41,7 @@ RUN groupadd -r www && \ #Download nginx & php RUN mkdir -p /home/nginx-php && cd $_ && \ wget -c -O nginx.tar.gz http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && \ - wget -O php.tar.gz http://php.net/distributions/php-$PHP_VERSION.tar.gz && \ + wget -O php.tar.gz http://php.net/distributions/php-$PHP_VERSION.tar.gz #Make install nginx RUN cd /home/nginx-php && \ From 3d2c7746d96499e0f7d48d303f3ffa689559fd90 Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 3 Aug 2016 22:23:57 +0800 Subject: [PATCH 57/67] add diy extensions --- Dockerfile | 2 +- README.md | 5 ++++- ext/xdebug.ini | 2 +- extension.sh => files/extension.sh | 5 +++-- start.sh => files/start.sh | 4 ++++ 5 files changed, 13 insertions(+), 5 deletions(-) rename extension.sh => files/extension.sh (89%) rename start.sh => files/start.sh (98%) diff --git a/Dockerfile b/Dockerfile index c518c60a..afac17a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -137,7 +137,7 @@ ADD ext/ /usr/local/php/etc/php.d/ ADD nginx.conf /usr/local/nginx/conf/ #Start -ADD start.sh / +ADD files/ / RUN chmod +x /start.sh #Set port diff --git a/README.md b/README.md index 47dcb29c..6c2cf999 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,10 @@ skiychan/nginx-php7 ## Enabling Extensions ```sh -docker run --name nginx -p 8080:80 -d -v /your_php_extension:/usr/local/php/etc/php.d skiychan/nginx-php7 +docker run --name nginx \ +-p 8080:80 -d \ +-v /your_php_extension_ini:/usr/local/php/etc/php.d \ +skiychan/nginx-php7 ``` ## [ChangeLog](changelogs.md) diff --git a/ext/xdebug.ini b/ext/xdebug.ini index 29d9eff9..9d8e7308 100644 --- a/ext/xdebug.ini +++ b/ext/xdebug.ini @@ -1,5 +1,5 @@ [xdebug] -zend_extension = xdebug.so +zend_extension = /usr/local/php/etc/php.d/xdebug.so xdebug.remote_enable = 1; xdebug.remote_connect_back = 1; xdebug.remote_port = 9999; diff --git a/extension.sh b/files/extension.sh similarity index 89% rename from extension.sh rename to files/extension.sh index df4388cc..2cc2111c 100644 --- a/extension.sh +++ b/files/extension.sh @@ -7,9 +7,10 @@ # Created Time: 2016/08/03 ######################################################################### -RUN mkdir -p /home/extension && cd $_ +RUN mkdir -p /home/extension -#Add xdebug extension +#Add extension xdebug +cd /home/extension && \ curl -O -SL https://github.com/xdebug/xdebug/archive/XDEBUG_2_4_0RC3.tar.gz && \ tar -zxvf XDEBUG_2_4_0RC3.tar.gz && \ cd xdebug-XDEBUG_2_4_0RC3 && \ diff --git a/start.sh b/files/start.sh similarity index 98% rename from start.sh rename to files/start.sh index f50c82ff..a4088f83 100644 --- a/start.sh +++ b/files/start.sh @@ -6,6 +6,10 @@ # Version: # Created Time: 2015/12/13 ######################################################################### + +# Add PHP Extension +sh /extension.sh + Nginx_Install_Dir=/usr/local/nginx DATA_DIR=/data/www From 564ca02357a1ef0a91fd0503c7d7eeabfea953c7 Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 3 Aug 2016 22:31:29 +0800 Subject: [PATCH 58/67] update changelog --- changelogs.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelogs.md b/changelogs.md index 92d3afb8..ad0afe86 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,3 +1,6 @@ +**2016 / 08 / 03:** +add diy extension support + **2016 / 08 / 02:** upgrade nginx to version 1.11.3 From d404535451df760a225af1703d0e98a06cbd1fbf Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 3 Aug 2016 23:38:06 +0800 Subject: [PATCH 59/67] update xdebug path --- ext/xdebug.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/xdebug.ini b/ext/xdebug.ini index 9d8e7308..29d9eff9 100644 --- a/ext/xdebug.ini +++ b/ext/xdebug.ini @@ -1,5 +1,5 @@ [xdebug] -zend_extension = /usr/local/php/etc/php.d/xdebug.so +zend_extension = xdebug.so xdebug.remote_enable = 1; xdebug.remote_connect_back = 1; xdebug.remote_port = 9999; From 98b270d3ae470600890e6040fe6ee0f44fa0833e Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 3 Aug 2016 23:42:39 +0800 Subject: [PATCH 60/67] update readme --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6c2cf999..8faba694 100644 --- a/README.md +++ b/README.md @@ -44,17 +44,20 @@ skiychan/nginx-php7 ``` ## Enabling Extensions +Add xxx.so and xxx.ini to folder ```/your_php_extension_files```, 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_files:/usr/local/php/etc/php.d \ skiychan/nginx-php7 ``` +You can see the **[wiki](https://github.com/skiy-dockerfile/nginx-php7/wiki/Question-&-Answer)** + ## [ChangeLog](changelogs.md) ## Author Author: Skiychan Email: dev@skiy.net -Link: https://www.zzzzy.com +Link: https://www.skiy.net From c26f17d318166ae46cc71036dbc93f16f569fe6a Mon Sep 17 00:00:00 2001 From: skiy Date: Wed, 3 Aug 2016 23:48:01 +0800 Subject: [PATCH 61/67] update readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8faba694..eaddef1f 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ docker run --name nginx \ -v /your_php_extension_files:/usr/local/php/etc/php.d \ skiychan/nginx-php7 ``` +in xxx.ini, "zend_extension = /usr/local/php/etc/php.d/xxx.so", the zend_extension must use ```/usr/local/php/etc/php.d/```. You can see the **[wiki](https://github.com/skiy-dockerfile/nginx-php7/wiki/Question-&-Answer)** From 0c28e5563e9d60845864e3c3f42514f05a51cdaa Mon Sep 17 00:00:00 2001 From: skiy Date: Thu, 4 Aug 2016 18:05:53 +0800 Subject: [PATCH 62/67] update extension clean cache files --- Dockerfile | 71 ++++++++++++++++++--------------- {files => extfile}/extension.sh | 0 {ext => extini}/xdebug.ini | 0 files/start.sh => start.sh | 4 +- 4 files changed, 42 insertions(+), 33 deletions(-) rename {files => extfile}/extension.sh (100%) rename {ext => extini}/xdebug.ini (100%) rename files/start.sh => start.sh (96%) diff --git a/Dockerfile b/Dockerfile index afac17a7..4d3db381 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,20 +4,19 @@ MAINTAINER Skiychan ENV NGINX_VERSION 1.11.3 ENV PHP_VERSION 7.0.9 -RUN yum install -y gcc \ +RUN set -x && \ + yum install -y gcc \ gcc-c++ \ autoconf \ automake \ libtool \ make \ cmake && \ - yum clean all #Install PHP library ## libmcrypt-devel DIY -RUN rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm && \ - yum install -y wget \ - zlib \ + 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 \ @@ -32,21 +31,18 @@ RUN rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch libmcrypt-devel \ openssh-server \ python-setuptools && \ - yum clean all #Add user -RUN groupadd -r www && \ - useradd -M -s /sbin/nologin -r -g www www + mkdir -p /data/{www,phpext} && \ + useradd -r -s /sbin/nologin -d /data/www -m -k no www && \ #Download nginx & php -RUN mkdir -p /home/nginx-php && cd $_ && \ - wget -c -O nginx.tar.gz http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && \ - wget -O php.tar.gz http://php.net/distributions/php-$PHP_VERSION.tar.gz + 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 -RUN cd /home/nginx-php && \ - tar -zxvf nginx.tar.gz && \ - cd nginx-$NGINX_VERSION && \ + cd /home/nginx-php/nginx-$NGINX_VERSION && \ ./configure --prefix=/usr/local/nginx \ --user=www --group=www \ --error-log-path=/var/log/nginx_error.log \ @@ -57,12 +53,10 @@ RUN cd /home/nginx-php && \ --without-mail_pop3_module \ --without-mail_imap_module \ --with-http_gzip_static_module && \ - make && make install + make && make install && \ #Make install php -RUN cd /home/nginx-php && \ - tar zvxf php.tar.gz && \ - cd php-$PHP_VERSION && \ + 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 \ @@ -105,39 +99,52 @@ RUN cd /home/nginx-php && \ --enable-ipv6 \ --disable-debug \ --without-pear && \ - make && make install + make && make install && \ #Install php-fpm -RUN cd /home/nginx-php/php-$PHP_VERSION && \ + 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 + cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf && \ #Install supervisor -RUN easy_install supervisor && \ - mkdir -p /var/log/supervisor && \ - mkdir -p /var/run/sshd && \ - mkdir -p /var/run/supervisord + 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/ -#Remove zips -RUN cd / && rm -rf /home/nginx-php - #Create web folder -VOLUME ["/data/www", "/usr/local/nginx/conf/ssl", "/usr/local/nginx/conf/vhost", "/usr/local/php/etc/php.d"] -RUN chown -R www:www /data/www +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 ext/ /usr/local/php/etc/php.d/ +ADD extini/ /usr/local/php/etc/php.d/ +ADD extfile/ /data/phpext/ #Update nginx config ADD nginx.conf /usr/local/nginx/conf/ #Start -ADD files/ / +ADD start.sh / RUN chmod +x /start.sh #Set port diff --git a/files/extension.sh b/extfile/extension.sh similarity index 100% rename from files/extension.sh rename to extfile/extension.sh diff --git a/ext/xdebug.ini b/extini/xdebug.ini similarity index 100% rename from ext/xdebug.ini rename to extini/xdebug.ini diff --git a/files/start.sh b/start.sh similarity index 96% rename from files/start.sh rename to start.sh index a4088f83..30117635 100644 --- a/files/start.sh +++ b/start.sh @@ -8,7 +8,9 @@ ######################################################################### # Add PHP Extension -sh /extension.sh +if [ -f "/data/phpext/extension.sh" ]; then + sh /data/phpext/extension.sh +fi Nginx_Install_Dir=/usr/local/nginx DATA_DIR=/data/www From eb32427401d9045dd32ea8c7cf23dd7d8bf0a0ec Mon Sep 17 00:00:00 2001 From: skiy Date: Thu, 4 Aug 2016 19:33:45 +0800 Subject: [PATCH 63/67] update support mongodb --- README.md | 28 +++++++++++++++++++++++----- extfile/extension.sh | 18 ++++++++++-------- extini/mongodb.ini | 1 + start.sh | 25 +++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 13 deletions(-) create mode 100644 extini/mongodb.ini diff --git a/README.md b/README.md index eaddef1f..7372d526 100644 --- a/README.md +++ b/README.md @@ -43,20 +43,38 @@ docker run -d --name=nginx \ skiychan/nginx-php7 ``` -## Enabling Extensions -Add xxx.so and xxx.ini to folder ```/your_php_extension_files```, then run the command: +## 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_files:/usr/local/php/etc/php.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 = /usr/local/php/etc/php.d/xxx.so", the zend_extension must use ```/usr/local/php/etc/php.d/```. +in xxx.ini, "zend_extension = /data/phpext/xxx.so", the zend_extension must be use ```/data/phpext/```. + +## 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 +``` You can see the **[wiki](https://github.com/skiy-dockerfile/nginx-php7/wiki/Question-&-Answer)** ## [ChangeLog](changelogs.md) - + +## Thanks +[Legion](https://www.dwhd.org) ## Author Author: Skiychan diff --git a/extfile/extension.sh b/extfile/extension.sh index 2cc2111c..f401ee99 100644 --- a/extfile/extension.sh +++ b/extfile/extension.sh @@ -7,14 +7,16 @@ # Created Time: 2016/08/03 ######################################################################### -RUN mkdir -p /home/extension - #Add extension xdebug -cd /home/extension && \ -curl -O -SL https://github.com/xdebug/xdebug/archive/XDEBUG_2_4_0RC3.tar.gz && \ -tar -zxvf XDEBUG_2_4_0RC3.tar.gz && \ -cd xdebug-XDEBUG_2_4_0RC3 && \ +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 && \ -cp modules/xdebug.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20151012/ \ No newline at end of file +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/start.sh b/start.sh index 30117635..87d87cb7 100644 --- a/start.sh +++ b/start.sh @@ -9,7 +9,32 @@ # Add PHP Extension if [ -f "/data/phpext/extension.sh" ]; then + #Add support + yum install -y gcc \ + gcc-c++ \ + autoconf \ + automake \ + libtool \ + make \ + cmake && \ + + mkdir -p /home/extension && \ + sh /data/phpext/extension.sh + + #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/extension/* fi Nginx_Install_Dir=/usr/local/nginx From 7361cb999c24bd027f367bf6dfb4632f30851f2e Mon Sep 17 00:00:00 2001 From: skiy Date: Thu, 4 Aug 2016 19:35:44 +0800 Subject: [PATCH 64/67] update change log --- changelogs.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelogs.md b/changelogs.md index ad0afe86..f8fc26a6 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,5 +1,7 @@ **2016 / 08 / 03:** add diy extension support +add mongodb support +clean the cache files, the mirror less 500M now. **2016 / 08 / 02:** upgrade nginx to version 1.11.3 From 8bb427a339b6c6a801531f408378bcd385ab42e9 Mon Sep 17 00:00:00 2001 From: skiy Date: Sun, 21 Aug 2016 13:24:57 +0800 Subject: [PATCH 65/67] update php to version 7.0.10 --- Dockerfile | 2 +- README.md | 2 +- changelogs.md | 41 ++++++++++++++++++++++------------------- start.sh | 2 ++ 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4d3db381..316a15ef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM centos:7 MAINTAINER Skiychan ENV NGINX_VERSION 1.11.3 -ENV PHP_VERSION 7.0.9 +ENV PHP_VERSION 7.0.10 RUN set -x && \ yum install -y gcc \ diff --git a/README.md b/README.md index 7372d526..5a3fdf97 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Nginx and PHP for Docker ## Last Version nginx: **1.11.3** -php: **7.0.9** +php: **7.0.10** ## Docker Hub **Nginx-PHP7:** [https://hub.docker.com/r/skiychan/nginx-php7](https://hub.docker.com/r/skiychan/nginx-php7) diff --git a/changelogs.md b/changelogs.md index f8fc26a6..920e173e 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,68 +1,71 @@ +**2016 / 08 / 21:** +update php to version 7.0.10 + **2016 / 08 / 03:** add diy extension support add mongodb support clean the cache files, the mirror less 500M now. **2016 / 08 / 02:** -upgrade nginx to version 1.11.3 +update nginx to version 1.11.3 **2016 / 07 / 22:** -upgrade php to version 7.0.9 +update php to version 7.0.9 **2016 / 07 / 05:** -upgrade nginx to version 1.11.2 +update nginx to version 1.11.2 **2016 / 06 / 23:** -upgrade php to version 7.0.8 +update php to version 7.0.8 **2016 / 06 / 02:** -upgrade nginx to version 1.11.1 +update nginx to version 1.11.1 **2016 / 05 / 26:** remove xdebug port -upgrade php to version 7.0.7 -upgrade nginx to version 1.11.0 +update php to version 7.0.7 +update nginx to version 1.11.0 **2016 / 05 / 06:** fixbug php-fpm repeated start update xdebug port to 9001 **2016 / 04 / 28:** -upgrade php to version 7.0.6 +update php to version 7.0.6 **2016 / 04 / 27:** -upgrade nginx to version 1.10.0 +update nginx to version 1.10.0 update xdebug port to 9999 **2016 / 04 / 20:** -upgrade nginx to version 1.9.15 +update nginx to version 1.9.15 **2016 / 04 / 06:** -upgrade nginx to version 1.9.14 +update nginx to version 1.9.14 **2016 / 04 / 01:** -upgrade php to version 7.0.5 -upgrade nginx to version 1.9.13 -upgrade xdebug info +update php to version 7.0.5 +update nginx to version 1.9.13 +update xdebug info **2016 / 03 / 04:** -upgrade php to version 7.0.4 +update php to version 7.0.4 **2016 / 02 / 29:** -upgrade nginx to version 1.9.12 +update nginx to version 1.9.12 **2016 / 02 / 13:** -upgrade nginx to version 1.9.11 +update nginx to version 1.9.11 **2016 / 02 / 04:** -upgrade php to version 7.0.3 +update php to version 7.0.3 **2016 / 01 / 29:** add fileinfo support add ipv6 support **2016 / 01 / 27:** -upgrade nginx to version 1.9.10 +update nginx to version 1.9.10 **2016 / 01 / 25:** add xdebug support diff --git a/start.sh b/start.sh index 87d87cb7..62eb7895 100644 --- a/start.sh +++ b/start.sh @@ -22,6 +22,8 @@ if [ -f "/data/phpext/extension.sh" ]; then sh /data/phpext/extension.sh + mv /data/phpext/extension.sh /data/phpext/extension_back.sh + #Clean OS yum remove -y gcc \ gcc-c++ \ From 4b48b8b5d3870319373db41ea1c4026d29b01280 Mon Sep 17 00:00:00 2001 From: skiy Date: Fri, 14 Oct 2016 21:31:11 +0800 Subject: [PATCH 66/67] updated version --- Dockerfile | 4 ++-- README.md | 4 ++-- changelogs.md | 54 +++++++++++++++++++++++++++------------------------ 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/Dockerfile b/Dockerfile index 316a15ef..d6bca8d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ FROM centos:7 MAINTAINER Skiychan -ENV NGINX_VERSION 1.11.3 -ENV PHP_VERSION 7.0.10 +ENV NGINX_VERSION 1.11.5 +ENV PHP_VERSION 7.0.12 RUN set -x && \ yum install -y gcc \ diff --git a/README.md b/README.md index 5a3fdf97..ae4f0464 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ Nginx and PHP for Docker ## Last Version -nginx: **1.11.3** -php: **7.0.10** +nginx: **1.11.5** +php: **7.0.12** ## Docker Hub **Nginx-PHP7:** [https://hub.docker.com/r/skiychan/nginx-php7](https://hub.docker.com/r/skiychan/nginx-php7) diff --git a/changelogs.md b/changelogs.md index 920e173e..e733b653 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,71 +1,75 @@ +**2016 / 10 / 14:** +updated php to version 7.0.12 +updated nginx to version 1.11.5 + **2016 / 08 / 21:** -update php to version 7.0.10 +updated php to version 7.0.10 **2016 / 08 / 03:** -add diy extension support -add mongodb support +added diy extension support +added mongodb support clean the cache files, the mirror less 500M now. **2016 / 08 / 02:** -update nginx to version 1.11.3 +updated nginx to version 1.11.3 **2016 / 07 / 22:** -update php to version 7.0.9 +updated php to version 7.0.9 **2016 / 07 / 05:** -update nginx to version 1.11.2 +updated nginx to version 1.11.2 **2016 / 06 / 23:** -update php to version 7.0.8 +updated php to version 7.0.8 **2016 / 06 / 02:** -update nginx to version 1.11.1 +updated nginx to version 1.11.1 **2016 / 05 / 26:** -remove xdebug port -update php to version 7.0.7 -update nginx to version 1.11.0 +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 -update xdebug port to 9001 +updated xdebug port to 9001 **2016 / 04 / 28:** -update php to version 7.0.6 +updated php to version 7.0.6 **2016 / 04 / 27:** -update nginx to version 1.10.0 -update xdebug port to 9999 +updated nginx to version 1.10.0 +updated xdebug port to 9999 **2016 / 04 / 20:** -update nginx to version 1.9.15 +updated nginx to version 1.9.15 **2016 / 04 / 06:** -update nginx to version 1.9.14 +updated nginx to version 1.9.14 **2016 / 04 / 01:** -update php to version 7.0.5 -update nginx to version 1.9.13 -update xdebug info +updated php to version 7.0.5 +updated nginx to version 1.9.13 +updated xdebug info **2016 / 03 / 04:** -update php to version 7.0.4 +updated php to version 7.0.4 **2016 / 02 / 29:** -update nginx to version 1.9.12 +updated nginx to version 1.9.12 **2016 / 02 / 13:** -update nginx to version 1.9.11 +updated nginx to version 1.9.11 **2016 / 02 / 04:** -update php to version 7.0.3 +updated php to version 7.0.3 **2016 / 01 / 29:** add fileinfo support add ipv6 support **2016 / 01 / 27:** -update nginx to version 1.9.10 +updated nginx to version 1.9.10 **2016 / 01 / 25:** add xdebug support From de9c776e26a22ae4ed27b6fd7479ecb9bd8f70f5 Mon Sep 17 00:00:00 2001 From: skiy Date: Sun, 4 Dec 2016 22:06:46 +0800 Subject: [PATCH 67/67] update version updated php to version 7.1.0 updated nginx to 1.11.6 --- Dockerfile | 4 ++-- README.md | 4 ++-- changelogs.md | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index d6bca8d0..6d41be6e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ FROM centos:7 MAINTAINER Skiychan -ENV NGINX_VERSION 1.11.5 -ENV PHP_VERSION 7.0.12 +ENV NGINX_VERSION 1.11.6 +ENV PHP_VERSION 7.1.0 RUN set -x && \ yum install -y gcc \ diff --git a/README.md b/README.md index ae4f0464..0191e0d9 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ Nginx and PHP for Docker ## Last Version -nginx: **1.11.5** -php: **7.0.12** +nginx: **1.11.6** +php: **7.1.0** ## Docker Hub **Nginx-PHP7:** [https://hub.docker.com/r/skiychan/nginx-php7](https://hub.docker.com/r/skiychan/nginx-php7) diff --git a/changelogs.md b/changelogs.md index e733b653..e9299fa0 100644 --- a/changelogs.md +++ b/changelogs.md @@ -1,3 +1,7 @@ +**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