国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

centos下docker的lnmp的環(huán)境,各部件獨立容器

233jl / 1678人閱讀

摘要:安裝卸載安裝需要環(huán)境配置安裝更新包安裝并啟動容器安裝宿主機上配置文件啟動并自定義配置文件和數(shù)據(jù)目錄注意這里的后續(xù)有用,因為是宿主機上,所以下次可以省略容器安裝啟動

docker安裝 卸載
yum remove docker docker-common docker-selinux docker-engine
安裝docker需要環(huán)境
yum install -y yum-utils device-mapper-persistent-data lvm2
配置安裝reps
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

#更新yum包
yum makecache fast
安裝docker 并啟動
yum install docker-ce
systemctl start docker
docker mysql 容器 安裝mysql
mkdir -p /web/docker/mysql/logs
mkdir -p /web/docker/mysql/pid
mkdir -p /web/docker/mysql/data
mkdir -p /web/docker/mysql/conf

docker pull mysql:5.6.37
宿主機上/web/docker/mysql/conf/my.cnf 配置文件
[mysqld]
slow_query_log = ON
slow_launch_time=5

#pid-file        = /web/docker/mysql/pid/mysqld.pid
#socket          = /web/docker/mysql/pid/mysqld.sock
datadir         = /web/docker/mysql/data
log-error       = /web/docker/mysql/logs/error.log
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
啟動并自定義配置文件和數(shù)據(jù)目錄
docker run -p 3306:3306 --name mysql-server -v /web/docker/mysql/conf:/etc/mysql/mysql.conf.d -v /web/docker/mysql:/web/docker/mysql -e MYSQL_ROOT_PASSWORD=123345 -d mysql:5.6.37

注意這里的--name mysql-server 后續(xù)有用,因為data是宿主機上,所以下次可以省略-e MYSQL_ROOT_PASSWORD=123345

docker php 容器 安裝php
docker pull php:5.6.31-fpm
啟動php-fpm
docker run --name php-fpm-1 --rm -p 9000:9000 -v /web/docker/nginx/www1:/var/www/html -d php:5.6.31-fpm
安裝iconv、mcrypt、gd和pdo_mysql擴展
docker exec -it container_id /bin/bash
apt-get update
apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libmcrypt-dev libpng12-dev
docker-php-ext-install -j$(nproc) iconv mcrypt
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
docker-php-ext-install -j$(nproc) gd
exit

container_id 是你php-fpm啟動后的容器id

安裝redis、xdebug、memcache擴展
pecl install redis-3.1.3
pecl install xdebug-2.5.5
docker-php-ext-enable redis xdebug

apt-get install -y libmemcached-dev zlib1g-dev
pecl install memcached-2.2.0
docker-php-ext-enable memcached
停止和重啟php-fpm重啟
docker stop container_id
docker start container_id

注意這里的/var/www/html是php-fpm的讀取源碼默認位置,請勿修改后續(xù)nginx里有配置相關對應

docker nginx 容器 安裝nginx
docker pull nginx:1.12.1
啟動nginx,并關聯(lián)mysql和php容器
mkdir -p /web/docker/nginx/logs
mkdir -p /web/docker/nginx/pid
mkdir -p /web/docker/nginx/www1
mkdir -p /web/docker/nginx/conf

docker run --name nginx-server-1 --link php-fpm-1:php-fpm --link mysql-server:mysql-server -v /web/docker/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v /web/docker/nginx:/web/docker/nginx -p 80:80 -d nginx:1.12.1

注意這里的/etc/nginx/nginx.conf是nginx的讀取源碼默認配置文件

/web/docker/nginx/www1/index.php
/web/docker/nginx/www1/index.html
nginx is working! 
create by qklin(object); wechat: qklandy!
/web/docker/nginx/conf/nginx.conf 配置
user  nginx;
worker_processes  2;

#error_log  /var/log/nginx/error.log warn;
#pid        /var/run/nginx.pid;
error_log  /web/docker/nginx/logs/error.log warn;
pid        /web/docker/nginx/pid/nginx.pid;

worker_rlimit_nofile 65535;

events {
    use epoll;
    worker_connections 65535;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    #charset  gb2312;

    server_names_hash_bucket_size 128;
    client_header_buffer_size 32k;
    large_client_header_buffers 4 32k;
    client_max_body_size 8m;

    sendfile on;

    tcp_nopush     on;

    keepalive_timeout 60;

    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 on;

    gzip_min_length  1k;

    gzip_buffers     4 16k;

    gzip_http_version 1.0;

    gzip_comp_level 2;

    gzip_types       text/plain application/x-javascript text/css application/xml;

    gzip_vary on;

    #limit_zone  crawler  $binary_remote_addr  10m;

    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  /var/log/nginx/access.log  main;

    include /web/docker/nginx/conf/vhost/*.conf;
}
vhost.example.conf
server {

    listen       80;
    server_name localhost;
    root  /web/docker/nginx/www1;
    location / {
                    index index.html index.htm index.php;
            }

   # limit_conn   crawler  20;

 location ~ ^.+.php$ {
        fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
        fastcgi_param  PATH_INFO $fastcgi_path_info;
        fastcgi_param  PATH_TRANSLATED $document_root$fastcgi_path_info;

        include /web/docker/nginx/conf/fastcgi.conf;

        fastcgi_pass php-fpm:9000;

    }
    location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ {
        expires      30d;
    }

    location ~ .*.(js|css)?$ {
        expires      1h;
    }
}
fastcgi.conf
#fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
#/var/www/html/ 為php-fpm容器里源碼存放的路徑,這個php-fpm能解析執(zhí)行php文件的關鍵
fastcgi_param  SCRIPT_FILENAME    /var/www/html/$fastcgi_script_name;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
try_files $fastcgi_script_name =404;
測試nginx
curl http://localhost/
curl http://localhost/index.php
docker redis 容器 安裝redis
docker pull redis:4.0.1
啟動redis
docker run -d -p 6379:6379 -v /web/docker/redis:/web/docker/redis --name redis-server-1 redis:4.0.1 redis-server /web/docker/redis/conf/redis1.conf

/web/docker/redis/data/redis1 redis數(shù)據(jù)庫文件夾(保存rdb和aof)

/web/docker/redis/conf/redis.conf
bind 127.0.0.1

protected-mode yes

tcp-backlog 511

timeout 0

tcp-keepalive 300

#daemonize yes

# supervision tree. Options:
#   supervised no      - no supervision interaction
#   supervised upstart - signal upstart by putting Redis into SIGSTOP mode
#   supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET
#   supervised auto    - detect upstart or systemd method based on
#                        UPSTART_JOB or NOTIFY_SOCKET environment variables
# Note: these supervision methods only signal "process is ready."
#       They do not enable continuous liveness pings back to your supervisor.
supervised no

#pidfile /var/run/redis_6379.pid

#loglevel notice

#logfile "/web/docker/redis/logs/redis-server.log"

databases 16

always-show-logo yes


save 900 1
save 300 10
save 60 10000

stop-writes-on-bgsave-error yes

rdbcompression yes

rdbchecksum yes

dbfilename dump.rdb

dir /web/docker/redis/data/redis1

slave-serve-stale-data yes

slave-read-only yes

repl-diskless-sync no

repl-diskless-sync-delay 5

repl-disable-tcp-nodelay no

slave-priority 100

lazyfree-lazy-expire no
lazyfree-lazy-server-del no
slave-lazy-flush no

appendonly yes

appendfilename "appendonly.aof"

appendfsync everysec

no-appendfsync-on-rewrite no


auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb

aof-load-truncated yes

aof-use-rdb-preamble no

lua-time-limit 5000

slowlog-log-slower-than 10000

slowlog-max-len 128

latency-monitor-threshold 0

notify-keyspace-events ""

hash-max-ziplist-entries 512
hash-max-ziplist-value 64

list-max-ziplist-size -2

list-compress-depth 0

set-max-intset-entries 512

zset-max-ziplist-entries 128
zset-max-ziplist-value 64

hll-sparse-max-bytes 3000

activerehashing yes

client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60

hz 10

aof-rewrite-incremental-fsync yes
redis4.0.1 官方源碼包里的redis.conf文件

點我查看

文章版權歸作者所有,未經(jīng)允許請勿轉載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/27032.html

相關文章

  • centosdockerlnmp環(huán)境部件獨立容器

    摘要:安裝卸載安裝需要環(huán)境配置安裝更新包安裝并啟動容器安裝宿主機上配置文件啟動并自定義配置文件和數(shù)據(jù)目錄注意這里的后續(xù)有用,因為是宿主機上,所以下次可以省略容器安裝啟動 docker安裝 卸載 yum remove docker docker-common docker-selinux docker-engine 安裝docker需要環(huán)境 yum install -y yum-utils d...

    DevTalking 評論0 收藏0
  • centosdockerlnmp環(huán)境部件獨立容器

    摘要:安裝卸載安裝需要環(huán)境配置安裝更新包安裝并啟動容器安裝宿主機上配置文件啟動并自定義配置文件和數(shù)據(jù)目錄注意這里的后續(xù)有用,因為是宿主機上,所以下次可以省略容器安裝啟動 docker安裝 卸載 yum remove docker docker-common docker-selinux docker-engine 安裝docker需要環(huán)境 yum install -y yum-utils d...

    HmyBmny 評論0 收藏0
  • 分解dockerlnmp環(huán)境搭建中作用

    摘要:如果不用我們可能將上述講的命令每搭建一次就需要執(zhí)行一遍,有沒有能統(tǒng)一管理的有,就是在環(huán)境搭建中的作用快速創(chuàng)建鏡像,快速創(chuàng)建并運行容器,實現(xiàn)統(tǒng)一管理。 前言 初學者在dcoker學習過程中,可能不太清楚docker中那么多的命令,參數(shù),工具在lnmp環(huán)境搭建中起了什么作用,下面跟著我來熟悉一下。(本文面向的是不怎么熟悉linux的:phper) 鏡像,容器,倉庫 鏡像:Docker 鏡像...

    tommego 評論0 收藏0
  • Docker部署WordPress LNMP(Nginx PHP MySQL)環(huán)境實踐

    摘要:為了能只使用一個文件就能快速部署環(huán)境,我們把及環(huán)境的相關配置保存到阿里云的代碼托管,然后使用阿里云的鏡像倉庫從拉取自動構建鏡像。編寫以上在阿里云創(chuàng)建的鏡像到本地,在此項目中創(chuàng)建然后在目錄分別創(chuàng)建目錄,用于存放它們各自及配置文件。 Docker基于LXC實現(xiàn)了把軟件封裝到一個完整的文件系統(tǒng),可以在docker容器中運行所需的一切代碼,運行環(huán)境,系統(tǒng)工具和系統(tǒng)庫。由于docker使用獨立于...

    Aklman 評論0 收藏0

發(fā)表評論

0條評論

最新活動
閱讀需要支付1元查看
<