惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tenable Blog
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
H
Help Net Security
F
Fortinet All Blogs
MyScale Blog
MyScale Blog
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 司徒正美
量子位
N
Netflix TechBlog - Medium
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
Recorded Future
Recorded Future
博客园 - 三生石上(FineUI控件)
Vercel News
Vercel News
aimingoo的专栏
aimingoo的专栏
I
InfoQ
Microsoft Security Blog
Microsoft Security Blog
Scott Helme
Scott Helme
The Last Watchdog
The Last Watchdog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
AI
AI
WordPress大学
WordPress大学
Security Archives - TechRepublic
Security Archives - TechRepublic
Google Online Security Blog
Google Online Security Blog
U
Unit 42
V2EX - 技术
V2EX - 技术
MongoDB | Blog
MongoDB | Blog
Schneier on Security
Schneier on Security
博客园 - Franky
H
Heimdal Security Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Jina AI
Jina AI
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
Cloudbric
Cloudbric
B
Blog RSS Feed
N
News | PayPal Newsroom
S
Securelist
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园_首页
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
雷峰网
雷峰网

博客园 - php、凯

优豆云:免费云服务的宝藏之选 docker xtom无法访问的解决办法 ubuntu 卸载php laravel response返回值精度问题 laravel collet分组 debian 系统搭建rsync+sersync实现实时同步 lnmp卸载删除多余的php版本 laravel操作mongo详细说明 Laradock中文文档 docker-composer 简单教程 laravel jwt实践 Laravel实现from的curl文件转发 docker添加mongo4.0.3并配置复制集 docker创建mysql5.7.22并配置主从 docker相关内容 Windows7安装 docker-compose的过程 史上最简单的Docker入门教程 MySQL触发器使用详解 存储过程
docker 搭建debian+nginx+php(含composer的扩展)+mysql+mongo+redis
php、凯 · 2020-03-03 · via 博客园 - php、凯

需要使用docker和docker-compose (自行安装)

1.目录结构

 debian 

  - Dockerfile 

  - start.sh //启动脚本

nginx

  - conf

    -   default.conf //默认配置文件(含laravel配置项)

  - nginx.conf //nginx配置文件

mongo

  - mongod.conf.orig  //mongo配置文件

  - sources.list //更换系统源为国内镜像(下同)

redis

  - redis.conf //redis配置文件

  - sources.list //同上

mysql

  - mysqld.cnf //mysql配置文件

  - sources.list //同上

php

  - php.ini //php配置文件

www

  - default 

    - index.php  //默认文件 <?php phpinfo(); ?>

2.文件详情

  debian/Dockerfile 

FROM debian:latest
  
RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak && \
    echo "" >/etc/apt/sources.list && \
    echo "deb http://mirrors.aliyun.com/debian/ buster main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb http://mirrors.aliyun.com/debian-security buster/updates main" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.aliyun.com/debian-security buster/updates main" >>/etc/apt/sources.list && \
    echo "deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib" >>/etc/apt/sources.list

RUN apt-get update && apt-get install vim curl zip wget git php7.3 php7.3-fpm php7.3-mysql php7.3-mbstring php7.3-dom php7.3-gd php7.3-mongodb php7.3-redis composer nginx sysv-rc-conf -y
RUN sysv-rc-conf nginx on && sysv-rc-conf php7.3-fpm on
RUN sed  -i  '79,79s/set mouse=a/set mouse-=a/g' /usr/share/vim/vim81/defaults.vim
ADD start.sh /start.sh
RUN chmod +x /start.sh

CMD /bin/bash -c /start.sh

View Code

  debian/ start.sh

#!/bin/bash
service nginx start
service php7.3-fpm start
tail -f /dev/null

View Code

  nginx/conf/default.conf

  1 server
  2     {
  3         listen 81 default_server reuseport;
  4         #listen [::]:80 default_server ipv6only=on;
  5         server_name _;
  6         index index.html index.htm index.php;
  7         root  /app/www/default;
  8 
  9         #error_page   404   /404.html;
 10 
 11         # Deny access to PHP files in specific directory
 12         #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
 13 
 14         #include enable-php.conf;
 15 
 16         location /nginx_status
 17         {
 18             stub_status on;
 19             access_log   off;
 20         }
 21 
 22         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
 23         {
 24             expires      30d;
 25         }
 26 
 27         location ~ .*\.(js|css)?$
 28         {
 29             expires      12h;
 30         }
 31 
 32         location ~ /.well-known {
 33             allow all;
 34         }
 35 
 36       # pass PHP scripts to FastCGI server
 37       #
 38       location ~ \.php$ {
 39             include snippets/fastcgi-php.conf;
 40             # With php-fpm (or other unix sockets):
 41             fastcgi_pass unix:/run/php/php7.3-fpm.sock;
 42             # With php-cgi (or other tcp sockets):
 43             #fastcgi_pass 127.0.0.1:9000;
 44         }
 45 
 46         location ~ /\.
 47         {
 48             deny all;
 49         }
 50 
 51         #access_log  /home/wwwlogs/access.log;
 52     }
 53 
 54 server
 55     {
 56         listen 80;
 57         #listen [::]:80 default_server ipv6only=on;
 58         server_name _;
 59         index index.html index.htm index.php;
 60         root  /app/www/boss/business/public;
 61 
 62         #error_page   404   /404.html;
 63 
 64         # Deny access to PHP files in specific directory
 65         #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
 66 
 67         #include enable-php.conf;
 68 
 69         location /nginx_status
 70         {
 71             stub_status on;
 72             access_log   off;
 73         }
 74 
 75         location / {
 76             try_files $uri $uri/ /index.php?$query_string;
 77         }
 78 
 79         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
 80         {
 81             expires      30d;
 82         }
 83 
 84         location ~ .*\.(js|css)?$
 85         {
 86             expires      12h;
 87         }
 88 
 89         location ~ /.well-known {
 90             allow all;
 91         }
 92 
 93         # pass PHP scripts to FastCGI server
 94         #
 95         location ~ \.php$ {
 96             include snippets/fastcgi-php.conf;
 97             # With php-fpm (or other unix sockets):
 98             fastcgi_pass unix:/run/php/php7.3-fpm.sock;
 99             # With php-cgi (or other tcp sockets):
100             #fastcgi_pass 127.0.0.1:9000;
101         }
102 
103         location ~ /\.
104         {
105             deny all;
106         }
107 
108         #access_log  /home/wwwlogs/access.log;
109     }

View Code

  nginx/nginx.conf 

 1 user www-data;
 2 worker_processes auto;
 3 pid /run/nginx.pid;
 4 include /etc/nginx/modules-enabled/*.conf;
 5 
 6 events {
 7   use epoll;
 8   worker_connections 768;
 9   multi_accept on;
10 }
11 
12 http {
13 
14   ##
15   # Basic Settings
16   ##
17 
18   sendfile on;
19   tcp_nopush on;
20   tcp_nodelay on;
21   keepalive_timeout 65;
22   types_hash_max_size 2048;
23   # server_tokens off;
24 
25   # server_names_hash_bucket_size 64;
26   # server_name_in_redirect off;
27 
28   include /etc/nginx/mime.types;
29   default_type application/octet-stream;
30 
31   ##
32   # SSL Settings
33   ##
34 
35   ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
36   ssl_prefer_server_ciphers on;
37 
38   ##
39   # Logging Settings
40   ##
41 
42   access_log /var/log/nginx/access.log;
43   error_log /var/log/nginx/error.log;
44 
45   ##
46   # Gzip Settings
47   ##
48 
49   gzip on;
50 
51   # gzip_vary on;
52   # gzip_proxied any;
53   # gzip_comp_level 6;
54   # gzip_buffers 16 8k;
55   # gzip_http_version 1.1;
56   # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
57 
58   ##
59   # Virtual Host Configs
60   ##
61 
62   include /etc/nginx/conf.d/*.conf;
63   #include /etc/nginx/sites-enabled/*;
64 }
65 
66 
67 #mail {
68 # # See sample authentication script at:
69 # # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
70 #
71 # # auth_http localhost/auth.php;
72 # # pop3_capabilities "TOP" "USER";
73 # # imap_capabilities "IMAP4rev1" "UIDPLUS";
74 #
75 # server {
76 #   listen     localhost:110;
77 #   protocol   pop3;
78 #   proxy      on;
79 # }
80 #
81 # server {
82 #   listen     localhost:143;
83 #   protocol   imap;
84 #   proxy      on;
85 # }
86 #}

View Code

  mongo/mongod.conf.orig

 1 # mongod.conf
 2 
 3 # for documentation of all options, see:
 4 #   http://docs.mongodb.org/manual/reference/configuration-options/
 5 
 6 # Where and how to store data.
 7 storage:
 8   dbPath: /var/lib/mongodb
 9   journal:
10     enabled: true
11 #  engine:
12 #  mmapv1:
13 #  wiredTiger:
14 
15 # where to write logging data.
16 systemLog:
17   destination: file
18   logAppend: true
19   path: /var/log/mongodb/mongod.log
20 
21 # network interfaces
22 net:
23   port: 27017
24   bindIp: 127.0.0.1
25 
26 
27 # how the process runs
28 processManagement:
29   timeZoneInfo: /usr/share/zoneinfo
30 
31 #security:
32 
33 #operationProfiling:
34 
35 #replication:
36 
37 #sharding:
38 
39 ## Enterprise-Only Options:
40 
41 #auditLog:
42 
43 #snmp:

View Code

  mongo/sources.list

 1 deb http://mirrors.aliyun.com/ubuntu/ xenial main
 2   
 3 deb-src http://mirrors.aliyun.com/ubuntu/ xenial main
 4 
 5 
 6 
 7 deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
 8 
 9 deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main
10 
11 
12 
13 deb http://mirrors.aliyun.com/ubuntu/ xenial universe
14 
15 deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
16 
17 deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
18 
19 deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
20 
21 
22 
23 deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
24 
25 deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
26 
27 deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
28 
29 deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe

View Code

  redis/redis.conf

 1 bind 0.0.0.0
 2 protected-mode no
 3 port 6379
 4 tcp-backlog 511
 5 timeout 0
 6 tcp-keepalive 300
 7 
 8 ################################# GENERAL #####################################
 9 daemonize no
10 supervised no
11 pidfile /var/run/redis_6379.pid
12 loglevel notice
13 logfile ""
14 databases 2
15 
16 ################################ SNAPSHOTTING  ################################
17 save 1 1
18 #save 900 1
19 save 300 10
20 save 60 10000
21 stop-writes-on-bgsave-error yes
22 rdbcompression yes
23 rdbchecksum yes
24 dbfilename dump.rdb
25 dir /data
26 
27 ################################# REPLICATION #################################
28 slave-serve-stale-data yes
29 slave-read-only yes
30 repl-diskless-sync no
31 repl-diskless-sync-delay 5
32 repl-disable-tcp-nodelay no
33 slave-priority 100
34 
35 ################################## SECURITY ###################################
36 requirepass redis
37 
38 ################################### LIMITS ####################################
39 maxclients 10000
40 
41 ############################## APPEND ONLY MODE ###############################
42 appendonly yes
43 appendfilename "appendonly.aof"
44 # appendfsync always
45 appendfsync everysec
46 # appendfsync no
47 no-appendfsync-on-rewrite no
48 auto-aof-rewrite-percentage 100
49 auto-aof-rewrite-min-size 64mb
50 aof-load-truncated yes
51 
52 ################################ LUA SCRIPTING  ###############################
53 lua-time-limit 5000
54 
55 ################################ REDIS CLUSTER  ###############################
56 cluster-enabled no
57 
58 ################################## SLOW LOG ###################################
59 slowlog-log-slower-than 10000
60 slowlog-max-len 128
61 
62 ################################ LATENCY MONITOR ##############################
63 latency-monitor-threshold 0
64 
65 ############################# EVENT NOTIFICATION ##############################
66 notify-keyspace-events ""
67 
68 ############################### ADVANCED CONFIG ###############################
69 hash-max-ziplist-entries 512
70 hash-max-ziplist-value 64
71 list-max-ziplist-size -2
72 list-compress-depth 0
73 set-max-intset-entries 512
74 zset-max-ziplist-entries 128
75 zset-max-ziplist-value 64
76 hll-sparse-max-bytes 3000
77 activerehashing yes
78 client-output-buffer-limit normal 0 0 0
79 client-output-buffer-limit slave 256mb 64mb 60
80 client-output-buffer-limit pubsub 32mb 8mb 60
81 hz 10
82 aof-rewrite-incremental-fsync yes

View Code

  redis/sources.list

 1 #
 2   
 3 # deb cdrom:[Debian GNU/Linux 10.1.0 _Buster_ - Official amd64 NETINST 20190908-01:07]/ buster main
 4 
 5 # deb cdrom:[Debian GNU/Linux 10.1.0 _Buster_ - Official amd64 NETINST 20190908-01:07]/ buster main
 6 
 7 deb http://mirrors.aliyun.com/debian/ buster main non-free contrib
 8 deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib
 9 deb http://mirrors.aliyun.com/debian-security buster/updates main
10 deb-src http://mirrors.aliyun.com/debian-security buster/updates main
11 deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
12 deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
13 deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
14 deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
15 #deb [arch=amd64] https://download.docker.com/linux/debian buster stable
16 
17 # buster-updates, previously known as 'volatile'
18 
19 # This system was installed using small removable media
20 # (e.g. netinst, live or single CD). The matching "deb cdrom"
21 # entries were disabled at the end of the installation process.
22 # For information about how to configure apt package sources,
23 # see the sources.list(5) manual.
24 # deb-src [arch=amd64] https://download.docker.com/linux/debian buster stable

View Code

  mysql/mysqld.cnf

 1 # Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
 2 # 
 3 # This program is free software; you can redistribute it and/or modify
 4 # it under the terms of the GNU General Public License as published by
 5 # the Free Software Foundation; version 2 of the License.
 6 #
 7 # This program is distributed in the hope that it will be useful,
 8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 # GNU General Public License for more details.
11 #
12 # You should have received a copy of the GNU General Public License
13 # along with this program; if not, write to the Free Software
14 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
15 
16 #
17 # The MySQL  Server configuration file.
18 #
19 # For explanations see
20 # http://dev.mysql.com/doc/mysql/en/server-system-variables.html
21 
22 [mysqld]
23 pid-file  = /var/run/mysqld/mysqld.pid
24 socket    = /var/run/mysqld/mysqld.sock
25 datadir   = /var/lib/mysql
26 #log-error  = /var/log/mysql/error.log
27 # By default we only accept connections from localhost
28 #bind-address = 127.0.0.1
29 # Disabling symbolic-links is recommended to prevent assorted security risks
30 symbolic-links=0

View Code

  mysql/sources.list

1 deb http://mirrors.163.com/debian/ stretch main non-free contrib
2 deb http://mirrors.163.com/debian/ stretch-updates main non-free contrib
3 deb http://mirrors.163.com/debian/ stretch-backports main non-free contrib
4 deb-src http://mirrors.163.com/debian/ stretch main non-free contrib
5 deb-src http://mirrors.163.com/debian/ stretch-updates main non-free contrib
6 deb-src http://mirrors.163.com/debian/ stretch-backports main non-free contrib
7 deb http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib
8 deb-src http://mirrors.163.com/debian-security/ stretch/updates main non-free contrib

View Code

  php/php.ini //文件过大,代码胜率 自行查询

  www/default/index.php //代码自行插入

纵然世间炎凉百态!我自依旧初心不改!!