• Docker php 环境搭建dockerfile


    搭建基于ubuntu的基础环境:

      参考:  http://open.daocloud.io/ru-he-kai-fa-yi-ge-php-mysql-de-docker-hua-ying-yong/

           https://github.com/nicescale/docker-training/tree/master/first 


      Dockerfile:

     1 #在ubuntu:trusty 基础上 安装 服务器必须环境信息 ,为后续 安装 php nginx 做准备
     2 
     3 FROM ubuntu:14.04
     4 
     5 MAINTAINER lxd 
     6 
     7 # 设置时间环境变量
     8 ENV TZ "Asia/Shanghai"
     9 
    10 #使用 阿里云 ubuntu 源
    11 RUN cp /etc/apt/sources.list /etc/apt/sources.list_back
    12 ADD sources.list /etc/apt/sources.list
    13 
    14 # 刷新 源
    15 RUN apt-get update
    16 
    17 #安装 软件
    18 RUN apt-get install -y curl wget tar bzip2 unzip vim passwd sudo hostname net-tools rsync man && 
    19     apt-get install -y gcc git make automake cmake patch logrotate && 
    20     apt-get install -y supervisor openssh-server && 
    21     apt-get clean && 
    22     apt-get autoclean
    23 
    24 #写入 supervisord 配置信息
    25 ADD supervisord.conf /etc/supervisord.conf
    26 
    27 #创建必须的文件夹
    28 RUN mkdir -p /etc/supervisor.conf.d && 
    29     mkdir -p /var/log/supervisor
    30 
    31 #暴露 22 端口,sshd
    32 EXPOSE 22
    33 
    34 #执行动作
    35 ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisord.conf"]
    View Code

      sources.list

     1 deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
     2 deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
     3 deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
     4 deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
     5 deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
     6 deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
     7 deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
     8 deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
     9 deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
    10 deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
    View Code

      supervisord.conf

     1 [unix_http_server]
     2 file=/var/run/supervisor.sock ; (the path to the socket file)
     3 chmod=0700              ; socket file mode (default 0700)
     4 
     5 [supervisord]
     6 logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
     7 logfile_maxbytes=50MB
     8 logfile_backup=10
     9 loglevel=info
    10 pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
    11 nodaemon=true           ; (Start in foreground if true; default false)
    12 minfds=1024                 ; (min. avail startup file descriptors;default 1024)
    13 minprocs=200                ; (min. avail process descriptors;default 200)
    14 
    15 [rpcinterface:supervisor]
    16 supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
    17 
    18 [supervisorctl]
    19 serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL  for a unix socket
    20 
    21 [include]
    22 files = /etc/supervisor.conf.d/*.conf
    View Code

    在ubuntu基础环境上搭建 nginx + php

    将上面的 docker build 命名为:lxd/ubuntu:base

      Dockerfile

     1 #在 ubuntu 基础环境上 ,搭建 php nginx
     2 
     3 #这个是 自己安装的 基础环境 镜像, 在 ~/docker/r_back/ubuntu_base 里面的Dockerfile 安装的
     4 FROM lxd/ubuntu:base
     5 
     6 MAINTAINER lxd 
     7 
     8 # 文件存放目录
     9 ENV APP_DIR /app
    10 ENV TERM xterm
    11 
    12 #升级
    13 RUN apt-get update
    14 
    15 #安装 nginx php5-fpm 等软件  php5-dev 是要安装的,装扩展就依赖它的phpize,php-config
    16 RUN apt-get install -y 
    17         php5-fpm php5-dev php5-cli php5-mysql php5-gd php5-curl php-pear php-apc 
    18         nginx && 
    19     apt-get clean && 
    20     apt-get autoclean && 
    21     rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
    22 
    23 #安装 composer 
    24 RUN curl -sS https://getcomposer.org/installer 
    25         | php -- --install-dir=/usr/local/bin --filename=composer
    26 
    27 #更新nginx 配置文件信息
    28 ADD nginx_nginx.conf /etc/nginx/nginx.conf
    29 ADD nginx_default.conf /etc/nginx/conf.d/default.conf
    30 
    31 #更新 php-fpm 配置
    32 ADD php_www.conf /etc/php5/fpm/pool.d/www.conf
    33 
    34 RUN sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php5/fpm/php.ini
    35 
    36 #写入phpinfo.php 配置文件
    37 RUN mkdir -p /app && echo "<?php phpinfo(); ?>" > ${APP_DIR}/phpinfo.php
    38 #RUN chmod 0777 /app
    39 
    40 #暴露端口 80 443
    41 EXPOSE 80 443
    42 
    43 #新增 supervisor 配置信息
    44 ADD supervisor_nginx.conf /etc/supervisor.conf.d/nginx.conf
    45 ADD supervisor_php5-fpm.conf /etc/supervisor.conf.d/php5-fpm.conf
    View Code

    nginx_default.conf

     1 server {
     2     listen       80 default_server;
     3     server_name  localhost;
     4 
     5     #charset koi8-r;
     6 
     7     location / {
     8         root   /app;
     9         index  index.php index.html index.htm;
    10     }
    11 
    12     # redirect server error pages to the static page /50x.html
    13     #
    14     error_page   500 502 503 504  /50x.html;
    15     location = /50x.html {
    16         root   /app;
    17     }
    18 
    19     # Disable nginx log write favicon.ico
    20     location = /favicon.ico {
    21     log_not_found off;
    22     access_log off;
    23     }
    24 
    25     # pass the PHP scripts to FastCGI server listening on port 9000
    26     #
    27     location ~ .php$ {
    28         root           /app;
    29         fastcgi_pass   127.0.0.1:9000;
    30         #fastcgi_pass  unix:/tmp/php-fpm.sock;
    31         fastcgi_index  index.php;
    32         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    33         include        fastcgi_params;
    34     }
    35 }
    View Code

    nginx_nginx.conf

     1 user www-data www-data;
     2 worker_processes  1;
     3 daemon  off;
     4 
     5 error_log  /var/log/nginx/error.log warn;
     6 pid        /var/run/nginx.pid;
     7 
     8 events {
     9     worker_connections  1024;
    10 }
    11 
    12 http {
    13     include       /etc/nginx/mime.types;
    14     default_type  application/octet-stream;
    15 
    16     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    17                       '$status $body_bytes_sent "$http_referer" '
    18                       '"$http_user_agent" "$http_x_forwarded_for"';
    19 
    20     access_log  /var/log/nginx/access.log  main;
    21 
    22     sendfile       on;
    23     tcp_nopush     on;
    24     tcp_nodelay    on;
    25     keepalive_timeout  65;
    26     types_hash_max_size 2048;
    27 
    28     gzip  on;
    29     gzip_disable  "msie6";
    30     gzip_vary  on;
    31     gzip_proxied  any;
    32     gzip_comp_level  6;
    33     gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    34 
    35     autoindex on;# 显示目录
    36     autoindex_exact_size on;# 显示文件大小
    37     autoindex_localtime on;# 显示文件时间
    38 
    39     include /etc/nginx/conf.d/*.conf;
    40 }
    View Code

    php_www.conf ( 更新 command=/usr/sbin/php5-fpm --nodaemonize)

      1 ; Start a new pool named 'www'.
      2 [www]
      3 
      4 ; The address on which to accept FastCGI requests.
      5 ; Valid syntaxes are:
      6 ;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific address on
      7 ;                            a specific port;
      8 ;   'port'                 - to listen on a TCP socket to all addresses on a
      9 ;                            specific port;
     10 ;   '/path/to/unix/socket' - to listen on a unix socket.
     11 ; Note: This value is mandatory.
     12 listen = 127.0.0.1:9000
     13 
     14 ; Set listen(2) backlog. A value of '-1' means unlimited.
     15 ; Default Value: -1
     16 ;listen.backlog = -1
     17 
     18 ; List of ipv4 addresses of FastCGI clients which are allowed to connect.
     19 ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
     20 ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
     21 ; must be separated by a comma. If this value is left blank, connections will be
     22 ; accepted from any ip address.
     23 ; Default Value: any
     24 listen.allowed_clients = 127.0.0.1
     25 
     26 ; Set permissions for unix socket, if one is used. In Linux, read/write
     27 ; permissions must be set in order to allow connections from a web server. Many
     28 ; BSD-derived systems allow connections regardless of permissions.
     29 ; Default Values: user and group are set as the running user
     30 ;                 mode is set to 0666
     31 ;listen.owner = nobody
     32 ;listen.group = nobody
     33 ;listen.mode = 0666
     34 
     35 ; Unix user/group of processes
     36 ; Note: The user is mandatory. If the group is not set, the default user's group
     37 ;       will be used.
     38 ; RPM: apache Choosed to be able to access some dir as httpd
     39 user = www-data
     40 ; RPM: Keep a group allowed to write in log dir.
     41 group = www-data
     42 
     43 ; Choose how the process manager will control the number of child processes.
     44 ; Possible Values:
     45 ;   static  - a fixed number (pm.max_children) of child processes;
     46 ;   dynamic - the number of child processes are set dynamically based on the
     47 ;             following directives:
     48 ;             pm.max_children      - the maximum number of children that can
     49 ;                                    be alive at the same time.
     50 ;             pm.start_servers     - the number of children created on startup.
     51 ;             pm.min_spare_servers - the minimum number of children in 'idle'
     52 ;                                    state (waiting to process). If the number
     53 ;                                    of 'idle' processes is less than this
     54 ;                                    number then some children will be created.
     55 ;             pm.max_spare_servers - the maximum number of children in 'idle'
     56 ;                                    state (waiting to process). If the number
     57 ;                                    of 'idle' processes is greater than this
     58 ;                                    number then some children will be killed.
     59 ; Note: This value is mandatory.
     60 pm = dynamic
     61 
     62 ; The number of child processes to be created when pm is set to 'static' and the
     63 ; maximum number of child processes to be created when pm is set to 'dynamic'.
     64 ; This value sets the limit on the number of simultaneous requests that will be
     65 ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
     66 ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
     67 ; CGI.
     68 ; Note: Used when pm is set to either 'static' or 'dynamic'
     69 ; Note: This value is mandatory.
     70 pm.max_children = 50
     71 
     72 ; The number of child processes created on startup.
     73 ; Note: Used only when pm is set to 'dynamic'
     74 ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
     75 pm.start_servers = 5
     76 
     77 ; The desired minimum number of idle server processes.
     78 ; Note: Used only when pm is set to 'dynamic'
     79 ; Note: Mandatory when pm is set to 'dynamic'
     80 pm.min_spare_servers = 5
     81 
     82 ; The desired maximum number of idle server processes.
     83 ; Note: Used only when pm is set to 'dynamic'
     84 ; Note: Mandatory when pm is set to 'dynamic'
     85 pm.max_spare_servers = 35
     86 
     87 ; The number of requests each child process should execute before respawning.
     88 ; This can be useful to work around memory leaks in 3rd party libraries. For
     89 ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
     90 ; Default Value: 0
     91 ;pm.max_requests = 500
     92 
     93 ; The URI to view the FPM status page. If this value is not set, no URI will be
     94 ; recognized as a status page. By default, the status page shows the following
     95 ; information:
     96 ;   accepted conn    - the number of request accepted by the pool;
     97 ;   pool             - the name of the pool;
     98 ;   process manager  - static or dynamic;
     99 ;   idle processes   - the number of idle processes;
    100 ;   active processes - the number of active processes;
    101 ;   total processes  - the number of idle + active processes.
    102 ; The values of 'idle processes', 'active processes' and 'total processes' are
    103 ; updated each second. The value of 'accepted conn' is updated in real time.
    104 ; Example output:
    105 ;   accepted conn:   12073
    106 ;   pool:             www
    107 ;   process manager:  static
    108 ;   idle processes:   35
    109 ;   active processes: 65
    110 ;   total processes:  100
    111 ; By default the status page output is formatted as text/plain. Passing either
    112 ; 'html' or 'json' as a query string will return the corresponding output
    113 ; syntax. Example:
    114 ;   http://www.foo.bar/status
    115 ;   http://www.foo.bar/status?json
    116 ;   http://www.foo.bar/status?html
    117 ; Note: The value must start with a leading slash (/). The value can be
    118 ;       anything, but it may not be a good idea to use the .php extension or it
    119 ;       may conflict with a real PHP file.
    120 ; Default Value: not set
    121 ;pm.status_path = /status
    122 
    123 ; The ping URI to call the monitoring page of FPM. If this value is not set, no
    124 ; URI will be recognized as a ping page. This could be used to test from outside
    125 ; that FPM is alive and responding, or to
    126 ; - create a graph of FPM availability (rrd or such);
    127 ; - remove a server from a group if it is not responding (load balancing);
    128 ; - trigger alerts for the operating team (24/7).
    129 ; Note: The value must start with a leading slash (/). The value can be
    130 ;       anything, but it may not be a good idea to use the .php extension or it
    131 ;       may conflict with a real PHP file.
    132 ; Default Value: not set
    133 ;ping.path = /ping
    134 
    135 ; This directive may be used to customize the response of a ping request. The
    136 ; response is formatted as text/plain with a 200 response code.
    137 ; Default Value: pong
    138 ;ping.response = pong
    139 
    140 ; The timeout for serving a single request after which the worker process will
    141 ; be killed. This option should be used when the 'max_execution_time' ini option
    142 ; does not stop script execution for some reason. A value of '0' means 'off'.
    143 ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
    144 ; Default Value: 0
    145 ;request_terminate_timeout = 0
    146 
    147 ; The timeout for serving a single request after which a PHP backtrace will be
    148 ; dumped to the 'slowlog' file. A value of '0s' means 'off'.
    149 ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
    150 ; Default Value: 0
    151 ;request_slowlog_timeout = 0
    152 
    153 ; The log file for slow requests
    154 ; Default Value: not set
    155 ; Note: slowlog is mandatory if request_slowlog_timeout is set
    156 slowlog = /var/log/php-fpm/www-slow.log
    157 
    158 ; Set open file descriptor rlimit.
    159 ; Default Value: system defined value
    160 ;rlimit_files = 1024
    161 
    162 ; Set max core size rlimit.
    163 ; Possible Values: 'unlimited' or an integer greater or equal to 0
    164 ; Default Value: system defined value
    165 ;rlimit_core = 0
    166 
    167 ; Chroot to this directory at the start. This value must be defined as an
    168 ; absolute path. When this value is not set, chroot is not used.
    169 ; Note: chrooting is a great security feature and should be used whenever
    170 ;       possible. However, all PHP paths will be relative to the chroot
    171 ;       (error_log, sessions.save_path, ...).
    172 ; Default Value: not set
    173 ;chroot =
    174 
    175 ; Chdir to this directory at the start. This value must be an absolute path.
    176 ; Default Value: current directory or / when chroot
    177 ;chdir = /var/www
    178 
    179 ; Redirect worker stdout and stderr into main error log. If not set, stdout and
    180 ; stderr will be redirected to /dev/null according to FastCGI specs.
    181 ; Default Value: no
    182 ;catch_workers_output = yes
    183 
    184 ; Limits the extensions of the main script FPM will allow to parse. This can
    185 ; prevent configuration mistakes on the web server side. You should only limit
    186 ; FPM to .php extensions to prevent malicious users to use other extensions to
    187 ; exectute php code.
    188 ; Note: set an empty value to allow all extensions.
    189 ; Default Value: .php
    190 ;security.limit_extensions = .php .php3 .php4 .php5
    191 
    192 ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
    193 ; the current environment.
    194 ; Default Value: clean env
    195 ;env[HOSTNAME] = $HOSTNAME
    196 ;env[PATH] = /usr/local/bin:/usr/bin:/bin
    197 ;env[TMP] = /tmp
    198 ;env[TMPDIR] = /tmp
    199 ;env[TEMP] = /tmp
    200 
    201 ; Additional php.ini defines, specific to this pool of workers. These settings
    202 ; overwrite the values previously defined in the php.ini. The directives are the
    203 ; same as the PHP SAPI:
    204 ;   php_value/php_flag             - you can set classic ini defines which can
    205 ;                                    be overwritten from PHP call 'ini_set'.
    206 ;   php_admin_value/php_admin_flag - these directives won't be overwritten by
    207 ;                                     PHP call 'ini_set'
    208 ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
    209 
    210 ; Defining 'extension' will load the corresponding shared extension from
    211 ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
    212 ; overwrite previously defined php.ini values, but will append the new value
    213 ; instead.
    214 
    215 ; Default Value: nothing is defined by default except the values in php.ini and
    216 ;                specified at startup with the -d argument
    217 ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
    218 ;php_flag[display_errors] = off
    219 php_admin_value[error_log] = /var/log/php-fpm/www-error.log
    220 php_admin_flag[log_errors] = on
    221 ;php_admin_value[memory_limit] = 128M
    222 
    223 ; Set session path to a directory owned by process user
    224 php_value[session.save_handler] = files
    225 php_value[session.save_path] = /var/lib/php/session
    View Code

    supervisor_nginx.conf

    1 [program:nginx]
    2 directory=/
    3 command=/usr/sbin/nginx -c /etc/nginx/nginx.conf
    4 user=root
    5 autostart=true
    6 autorestart=true
    7 stdout_logfile=/var/log/supervisor/%(program_name)s.log
    8 stderr_logfile=/var/log/supervisor/%(program_name)s.log
    View Code

    supervisor_php5-fpm.conf

    1 [program:php-fpm]
    2 directory=/
    3 command=/usr/sbin/php5-fpm
    4 user=root
    5 autostart=true
    6 autorestart=true
    7 stdout_logfile=/var/log/supervisor/%(program_name)s.log
    8 stderr_logfile=/var/log/supervisor/%(program_name)s.log
    View Code

    在ubuntu基础环境上搭建 mysql

    Dockerfile

     1 #安装 mysql 服务器
     2 FROM lxd/ubuntu:base
     3 
     4 MAINTAINER lxd
     5 
     6 #升级
     7 RUN apt-get update
     8 
     9 #安装 mysql
    10 RUN apt-get install -y mysql-server-5.6 && 
    11     apt-get clean && 
    12     apt-get autoclean && 
    13     rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
    14 
    15 #更新my.cnf
    16 RUN cp /etc/mysql/my.cnf /etc/mysql/my.cnf.back
    17 ADD my.cnf /etc/mysql/my.cnf
    18 
    19 #暴露3306端口
    20 EXPOSE 3306
    21 
    22 #复制 supervisor 配置信息
    23 ADD supervisor_mysql.conf /etc/supervisor.conf.d/mysql5.6.conf
    View Code

    my.cnf

      1 #
      2 # The MySQL database server configuration file.
      3 #
      4 # You can copy this to one of:
      5 # - "/etc/mysql/my.cnf" to set global options,
      6 # - "~/.my.cnf" to set user-specific options.
      7 # 
      8 # One can use all long options that the program supports.
      9 # Run program with --help to get a list of available options and with
     10 # --print-defaults to see which it would actually understand and use.
     11 #
     12 # For explanations see
     13 # http://dev.mysql.com/doc/mysql/en/server-system-variables.html
     14 
     15 # This will be passed to all mysql clients
     16 # It has been reported that passwords should be enclosed with ticks/quotes
     17 # escpecially if they contain "#" chars...
     18 # Remember to edit /etc/mysql/debian.cnf when changing the socket location.
     19 skip-locking
     20 [client]
     21 port        = 3306
     22 socket        = /var/run/mysqld/mysqld.sock
     23 
     24 # Here is entries for some specific programs
     25 # The following values assume you have at least 32M ram
     26 
     27 # This was formally known as [safe_mysqld]. Both versions are currently parsed.
     28 [mysqld_safe]
     29 socket        = /var/run/mysqld/mysqld.sock
     30 nice        = 0
     31 
     32 [mysqld]
     33 #
     34 # * Basic Settings
     35 #
     36 user        = mysql
     37 pid-file    = /var/run/mysqld/mysqld.pid
     38 socket        = /var/run/mysqld/mysqld.sock
     39 port        = 3306
     40 basedir        = /var/lib
     41 datadir        = /var/lib/mysql
     42 tmpdir        = /tmp
     43 lc-messages-dir    = /usr/share/mysql
     44 skip-external-locking
     45 #
     46 # Instead of skip-networking the default is now to listen only on
     47 # localhost which is more compatible and is not less secure.
     48 #bind-address        = 127.0.0.1
     49 #
     50 # * Fine Tuning
     51 #
     52 key_buffer        = 16M
     53 max_allowed_packet    = 16M
     54 thread_stack        = 192K
     55 thread_cache_size       = 8
     56 # This replaces the startup script and checks MyISAM tables if needed
     57 # the first time they are touched
     58 myisam-recover         = BACKUP
     59 #max_connections        = 100
     60 #table_cache            = 64
     61 #thread_concurrency     = 10
     62 #
     63 # * Query Cache Configuration
     64 #
     65 query_cache_limit    = 1M
     66 query_cache_size        = 16M
     67 #
     68 # * Logging and Replication
     69 #
     70 # Both location gets rotated by the cronjob.
     71 # Be aware that this log type is a performance killer.
     72 # As of 5.1 you can enable the log at runtime!
     73 #general_log_file        = /var/log/mysql/mysql.log
     74 #general_log             = 1
     75 #
     76 # Error log - should be very few entries.
     77 #
     78 log_error = /var/log/mysql/error.log
     79 #
     80 # Here you can see queries with especially long duration
     81 #log_slow_queries    = /var/log/mysql/mysql-slow.log
     82 #long_query_time = 2
     83 #log-queries-not-using-indexes
     84 #
     85 # The following can be used as easy to replay backup logs or for replication.
     86 # note: if you are setting up a replication slave, see README.Debian about
     87 #       other settings you may need to change.
     88 #server-id        = 1
     89 #log_bin            = /var/log/mysql/mysql-bin.log
     90 expire_logs_days    = 10
     91 max_binlog_size         = 100M
     92 #binlog_do_db        = include_database_name
     93 #binlog_ignore_db    = include_database_name
     94 #
     95 # * InnoDB
     96 #
     97 # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
     98 # Read the manual for more InnoDB related options. There are many!
     99 #
    100 # * Security Features
    101 #
    102 # Read the manual, too, if you want chroot!
    103 # chroot = /var/lib/mysql/
    104 #
    105 # For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
    106 #
    107 # ssl-ca=/etc/mysql/cacert.pem
    108 # ssl-cert=/etc/mysql/server-cert.pem
    109 # ssl-key=/etc/mysql/server-key.pem
    110 
    111 
    112 
    113 [mysqldump]
    114 quick
    115 quote-names
    116 max_allowed_packet    = 16M
    117 
    118 [mysql]
    119 #no-auto-rehash    # faster start of mysql but no tab completition
    120 
    121 [isamchk]
    122 key_buffer        = 16M
    123 
    124 #
    125 # * IMPORTANT: Additional settings that can override those from this file!
    126 #   The files must end with '.cnf', otherwise they'll be ignored.
    127 #
    128 !includedir /etc/mysql/conf.d/
    View Code

    supervisor_mysql.conf

    1 [program:mysql5.6]
    2 directory=/
    3 command=/usr/sbin/mysqld --defaults-file=/etc/mysql/my.cnf
    4 user=root
    5 autostart=true
    6 autorestart=true
    7 stdout_logfile=/var/log/supervisor/%(program_name)s.log
    8 stderr_logfile=/var/log/supervisor/%(program_name)s.log
    View Code
  • 相关阅读:
    关于公司电脑修改host文件无法生效的问题
    Cannot access nexus-aliyun (http://maven.aliyun.com/nexus/content/groups/public) in offline mode and the artifact org.springframework
    DCL-单例模式的线程安全
    关于volatile
    关于CAS中的ABA问题存在的隐患
    无法获取 dpkg 前端锁 (/var/lib/dpkg/lock-frontend),是否有其他进程正占用它
    vue整合笔记
    vue9-axios、细节和杂项
    vue8-vuex、路径配置别名、promise
    vue07-路由 vue-router、keep-alive、tab-bar
  • 原文地址:https://www.cnblogs.com/lxdd/p/5091586.html
Copyright © 2020-2023  润新知