当前位置:   article > 正文

Docker 搭建 LNMP + Wordpress(详细步骤)_wordpress-4.9.4-zh_cn.tar.gz

wordpress-4.9.4-zh_cn.tar.gz

目录

一、项目模拟

1. 项目环境

2. 服务器环境 

3.任务需求

二、Linux 系统基础镜像

三、Nginx 

1. 建立工作目录

2. 编写 Dockerfile 脚本 

3. 准备 nginx.conf 配置文件 

4. 生成镜像 

5. 创建自定义网络 

6. 启动镜像容器 

7. 验证 nginx 

四、Mysql 

1. 建立工作目录

2. 编写 Dockerfile 

3. 准备 my.cnf 文件 

4. 生成镜像 

5. 启动镜像容器 

6. 验证 mysql 

五、Php 

1. 建立工作目录

2. 编写 Dockerfile 脚本 

3. 准备 php.ini、php-fpm.conf、www.conf 配置文件 

3.1 php.ini

3.2 php-fpm.conf 

3.3 www.conf 

4. 生成镜像 

5. 启动镜像容器 

6. 验证 php 

六、启动 wordpress 服务 

1. mysql 授权

2. 浏览器访问测试 

一、项目模拟

1. 项目环境

公司在实际的生产环境中,需要使用 Docker 技术在一台主机上创建 LNMP 服务并运行 Wordpress 网站平台。然后对此服务进行相关的性能调优和管理工作。

所有安装包下载:

  1. wget http://101.34.22.188/lnmp_wordpress/mysql-boost-5.7.20.tar.gz
  2. wget http://101.34.22.188/lnmp_wordpress/nginx-1.12.0.tar.gz
  3. wget http://101.34.22.188/lnmp_wordpress/php-7.1.10.tar.bz2
  4. wget http://101.34.22.188/lnmp_wordpress/wordpress-4.9.4-zh_CN.tar.gz
  5. > 或者
  6. wget -r -np http://101.34.22.188/lnmp_wordpress/

2. 服务器环境 

容器操作系统IP地址主要软件
nginxCentOS 7172.111.0.10Docker-Nginx
mysqlCentOS 7172.111.0.20Docker-Mysql
phpCentOS 7172.111.0.30Docker-php

3.任务需求

  • 使用 Docker 构建 LNMP 环境并运行 Wordpress 网站平台
  • 限制 Nginx 容器最多使用 500MB 的内存和 1G 的 Swap
  • 限制 Mysql 容器写 /dev/sda 的速率为 10 MB/s
  • 将所有容器进行快照,然后将 Docker 镜像打包成 tar 包备份到本地

二、Linux 系统基础镜像

  1. [root@docker ~]# systemctl disable --now firewalld
  2. [root@docker ~]# setenforce 0
  3. setenforce: SELinux is disabled
  4. [root@docker ~]# docker pull centos:7
  5. #从公有仓库中下载 centos7 作为系统基础镜像
  6. [root@docker ~]# docker images
  7. REPOSITORY TAG IMAGE ID CREATED SIZE
  8. centos 7 eeb6ee3f44bd 4 weeks ago 204MB

三、Nginx 

1. 建立工作目录

  1. [root@docker ~]# mkdir /opt/nginx
  2. [root@docker ~]# cd /opt/nginx
  3. [root@docker nginx]# rz -E
  4. rz waiting to receive.
  5. #上传 nginx 安装包 nginx-1.12.0.tar.gz
  6. [root@docker nginx]# rz -E
  7. rz waiting to receive.
  8. #上传 wordpress 服务包 wordpress-4.9.4-zh_CN.tar.gz

2. 编写 Dockerfile 脚本 

  1. [root@docker nginx]# vim Dockerfile
  2. FROM centos:7
  3. MAINTAINER this is nginx image <lnmp>
  4. RUN yum -y install pcre-devel zlib-devel gcc gcc-c++ make;useradd -M -s /sbin/nologin nginx
  5. ADD nginx-1.12.0.tar.gz /usr/local/src/
  6. WORKDIR /usr/local/src/nginx-1.12.0
  7. RUN ./configure \
  8. --prefix=/usr/local/nginx \
  9. --user=nginx \
  10. --group=nginx \
  11. --with-http_stub_status_module;make -j 4 && make install
  12. ENV PATH /usr/local/nginx/sbin:$PATH
  13. ADD nginx.conf /usr/local/nginx/conf/
  14. ADD wordpress-4.9.4-zh_CN.tar.gz /usr/local/nginx/html
  15. RUN chmod 777 -R /usr/local/nginx/html/
  16. EXPOSE 80
  17. VOLUME [ "/usr/local/nginx/html/" ]
  18. CMD [ "/usr/local/nginx/sbin/nginx","-g","daemon off;" ]

3. 准备 nginx.conf 配置文件 

  1. [root@docker nginx]# ls
  2. Dockerfile nginx-1.12.0.tar.gz nginx.conf wordpress-4.9.4-zh_CN.tar.gz
  3. [root@docker nginx]# egrep -v "^(.)*#(.)*$" nginx.conf | grep -v "^$"
  4. worker_processes 1;
  5. events {
  6. worker_connections 1024;
  7. }
  8. http {
  9. include mime.types;
  10. default_type application/octet-stream;
  11. sendfile on;
  12. keepalive_timeout 65;
  13. server {
  14. listen 80;
  15. server_name localhost;
  16. charset utf-8;
  17. location / {
  18. root html;
  19. index index.html index.php;
  20. }
  21. error_page 500 502 503 504 /50x.html;
  22. location = /50x.html {
  23. root html;
  24. }
  25. location ~ \.php$ {
  26. root html;
  27. fastcgi_pass 172.111.0.30:9000;
  28. fastcgi_index index.php;
  29. fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
  30. include fastcgi_params;
  31. }
  32. }
  33. }

4. 生成镜像 

  1. [root@docker nginx]# docker build -t nginx:lnmp .
  2. [root@docker nginx]# docker images
  3. REPOSITORY TAG IMAGE ID CREATED SIZE
  4. nginx lnmp 35a6404fcfa1 5 seconds ago 522MB
  5. centos 7 eeb6ee3f44bd 4 weeks ago 204MB

5. 创建自定义网络 

  1. [root@docker nginx]# docker network create --subnet=172.111.0.0/16 --opt "com.docker.network.bridge.name"="docker1" mynetwork
  2. 0cbe1bd0bd782bf1c8e69916d99427970196de22deb312f970e01030406d9b45
  3. [root@docker nginx]# docker network ls
  4. NETWORK ID NAME DRIVER SCOPE
  5. dd7a55d01f86 bridge bridge local
  6. 63ddf1e359e9 host host local
  7. 0cbe1bd0bd78 mynetwork bridge local
  8. a4b66a8a6cd2 none null local
  9. [root@docker nginx]# ifconfig docker1
  10. docker1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
  11. inet 172.111.0.1 netmask 255.255.0.0 broadcast 172.111.255.255
  12. ether 02:42:40:dc:e8:1d txqueuelen 0 (Ethernet)
  13. RX packets 0 bytes 0 (0.0 B)
  14. RX errors 0 dropped 0 overruns 0 frame 0
  15. TX packets 0 bytes 0 (0.0 B)
  16. TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

6. 启动镜像容器 

  1. [root@docker nginx]# docker run -d --name nginx -p 80:80 -m 500m --memory-swap 1g --net mynetwork --ip 172.111.0.10 nginx:lnmp
  2. 57616d4ea225c82a50b731472b003dabfd681e8dc6c6ef85a9bb2f665354334b
  3. [root@docker nginx]# docker ps -a
  4. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
  5. 57616d4ea225 nginx:lnmp "/usr/local/nginx/sb…" 13 seconds ago Up 12 seconds 0.0.0.0:80->80/tcp, :::80->80/tcp nginx
  6. [root@docker nginx]# docker inspect nginx
  7. ······
  8. "IPv4Address": "172.111.0.10"
  9. ······

7. 验证 nginx 

  1. [root@docker nginx]# curl http://192.168.223.30:80
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <title>Welcome to nginx!</title>
  6. <style>
  7. body {
  8. width: 35em;
  9. margin: 0 auto;
  10. font-family: Tahoma, Verdana, Arial, sans-serif;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15. <h1>Welcome to nginx!</h1>
  16. <p>If you see this page, the nginx web server is successfully installed and
  17. working. Further configuration is required.</p>
  18. <p>For online documentation and support please refer to
  19. <a href="http://nginx.org/">nginx.org</a>.<br/>
  20. Commercial support is available at
  21. <a href="http://nginx.com/">nginx.com</a>.</p>
  22. <p><em>Thank you for using nginx.</em></p>
  23. </body>
  24. </html>

四、Mysql 

1. 建立工作目录

  1. [root@docker nginx]# mkdir /opt/mysql
  2. [root@docker nginx]# cd /opt/mysql/
  3. [root@docker mysql]# rz -E
  4. rz waiting to receive.
  5. #传入mysql安装包mysql-boost-5.7.20.tar.gz

2. 编写 Dockerfile 

  1. [root@docker mysql]# vim Dockerfile
  2. FROM centos:7
  3. MAINTAINER this is mysql image <lnmp>
  4. RUN yum -y install ncurses ncurses-devel bison cmake pcre-devel zlib-devel gcc gcc-c++ make;useradd -M -s /sbin/nologin mysql
  5. ADD mysql-boost-5.7.20.tar.gz /usr/local/src/
  6. WORKDIR /usr/local/src/mysql-5.7.20/
  7. RUN cmake \
  8. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
  9. -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
  10. -DSYSCONFDIR=/etc \
  11. -DSYSTEMD_PID_DIR=/usr/local/mysql \
  12. -DDEFAULT_CHARSET=utf8 \
  13. -DDEFAULT_COLLATION=utf8_general_ci \
  14. -DWITH_EXTRA_CHARSETS=all \
  15. -DWITH_INNOBASE_STORAGE_ENGINE=1 \
  16. -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
  17. -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
  18. -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
  19. -DMYSQL_DATADIR=/usr/local/mysql/data \
  20. -DWITH_BOOST=boost \
  21. -DWITH_SYSTEMD=1;make -j4;make install
  22. ADD my.cnf /etc/my.cnf
  23. EXPOSE 3306
  24. RUN chown -R mysql:mysql /usr/local/mysql/;chown mysql:mysql /etc/my.cnf
  25. WORKDIR /usr/local/mysql/bin/
  26. RUN ./mysqld \
  27. --initialize-insecure \
  28. --user=mysql \
  29. --basedir=/usr/local/mysql \
  30. --datadir=/usr/local/mysql/data;cp /usr/local/mysql/usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/;systemctl enable mysqld
  31. ENV PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
  32. VOLUME [ "/usr/local/mysql" ]
  33. CMD ["/usr/sbin/init"]

3. 准备 my.cnf 文件 

  1. [root@docker mysql]# vim my.cnf
  2. [client]
  3. port = 3306
  4. socket=/usr/local/mysql/mysql.sock
  5. [mysqld]
  6. user = mysql
  7. basedir=/usr/local/mysql
  8. datadir=/usr/local/mysql/data
  9. port = 3306
  10. character-set-server=utf8
  11. pid-file = /usr/local/mysql/mysqld.pid
  12. socket=/usr/local/mysql/mysql.sock
  13. bind-address = 0.0.0.0
  14. skip-name-resolve
  15. max_connections=2048
  16. default-storage-engine=INNODB
  17. max_allowed_packet=16M
  18. server-id = 1
  19. sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES

4. 生成镜像 

  1. [root@docker mysql]# docker build -t mysql:lnmp .
  2. [root@docker mysql]# docker images
  3. REPOSITORY TAG IMAGE ID CREATED SIZE
  4. mysql lnmp 49da8f7299af 3 minutes ago 9.98GB
  5. nginx lnmp 35a6404fcfa1 17 minutes ago 522MB
  6. centos 7 eeb6ee3f44bd 4 weeks ago 204MB

5. 启动镜像容器 

  1. [root@docker mysql]# docker run --name=mysql -d --privileged --device-write-bps /dev/sda:10M -v /usr/local/mysql --net mynetwork --ip 172.111.0.20 mysql:lnmp
  2. ebafbdc1c4dcfc49406a7db8ee5a2afc54f5b4203d11ad374dba885ec4ef5afd
  3. [root@docker mysql]# docker ps -a
  4. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
  5. ebafbdc1c4dc mysql:lnmp "/usr/sbin/init" 11 seconds ago Up 10 seconds 3306/tcp mysql
  6. 57616d4ea225 nginx:lnmp "/usr/local/nginx/sb…" 17 minutes ago Up 17 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp nginx

6. 验证 mysql 

  1. [root@docker mysql]# docker exec -it mysql bash
  2. [root@ebafbdc1c4dc bin]# systemctl status mysqld
  3. ● mysqld.service - MySQL Server
  4. Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
  5. Active: activating (start) since Sun 2022-07-20 01:05:59 UTC; 42s ago
  6. ······

五、Php 

1. 建立工作目录

  1. [root@docker mysql]# mkdir ../php
  2. [root@docker mysql]# cd ../php/
  3. [root@docker php]# rz -E
  4. rz waiting to receive.
  5. #传入php安装包php-7.1.10.tar.bz2

2. 编写 Dockerfile 脚本 

  1. [root@docker php]# vim Dockerfile
  2. FROM centos:7
  3. MAINTAINER this is php image <lnmp>
  4. RUN yum install -y gd \
  5. libjpeg libjpeg-devel \
  6. libpng libpng-devel \
  7. freetype freetype-devel \
  8. libxml2 libxml2-devel \
  9. zlib zlib-devel \
  10. curl curl-devel \
  11. openssl openssl-devel \
  12. gcc gcc-c++ make pcre-devel;useradd -M -s /sbin/nologin nginx
  13. ADD php-7.1.10.tar.bz2 /usr/local/src/
  14. WORKDIR /usr/local/src/php-7.1.10
  15. RUN ./configure \
  16. --prefix=/usr/local/php \
  17. --with-mysql-sock=/usr/local/mysql/mysql.sock \
  18. --with-mysqli \
  19. --with-zlib \
  20. --with-curl \
  21. --with-gd \
  22. --with-jpeg-dir \
  23. --with-png-dir \
  24. --with-freetype-dir \
  25. --with-openssl \
  26. --enable-fpm \
  27. --enable-mbstring \
  28. --enable-xml \
  29. --enable-session \
  30. --enable-ftp \
  31. --enable-pdo \
  32. --enable-tokenizer \
  33. --enable-zip ; make -j 4 ; make install
  34. ENV PATH /usr/local/php/bin:/usr/local/php/sbin:$PATH
  35. ADD php.ini /usr/local/php/lib/
  36. ADD php-fpm.conf /usr/local/php/etc/
  37. ADD www.conf /usr/local/php/etc/php-fpm.d/
  38. EXPOSE 9000
  39. CMD /usr/local/php/sbin/php-fpm -F

3. 准备 php.ini、php-fpm.conf、www.conf 配置文件 

3.1 php.ini

该配置文件模板位于安装目录的 php-7.1.10/php.ini-development 位置

  1. [root@docker php]# vim php.ini
  2. #939行,取消注释,修改
  3. date.timezone = Asia/Shanghai
  4. #1170行,修改
  5. mysqli.default_socket = /usr/local/mysql/mysql.sock
  6. [root@docker php]# egrep -v "^;" php.ini | egrep -v "^$"
  7. [PHP]
  8. engine = On
  9. short_open_tag = Off
  10. precision = 14
  11. output_buffering = 4096
  12. zlib.output_compression = Off
  13. implicit_flush = Off
  14. unserialize_callback_func =
  15. serialize_precision = -1
  16. disable_functions =
  17. disable_classes =
  18. zend.enable_gc = On
  19. expose_php = On
  20. max_execution_time = 30
  21. max_input_time = 60
  22. memory_limit = 128M
  23. error_reporting = E_ALL
  24. display_errors = On
  25. display_startup_errors = On
  26. log_errors = On
  27. log_errors_max_len = 1024
  28. ignore_repeated_errors = Off
  29. ignore_repeated_source = Off
  30. report_memleaks = On
  31. track_errors = On
  32. html_errors = On
  33. variables_order = "GPCS"
  34. request_order = "GP"
  35. register_argc_argv = Off
  36. auto_globals_jit = On
  37. post_max_size = 8M
  38. auto_prepend_file =
  39. auto_append_file =
  40. default_mimetype = "text/html"
  41. default_charset = "UTF-8"
  42. doc_root =
  43. user_dir =
  44. enable_dl = Off
  45. file_uploads = On
  46. upload_max_filesize = 2M
  47. max_file_uploads = 20
  48. allow_url_fopen = On
  49. allow_url_include = Off
  50. default_socket_timeout = 60
  51. [CLI Server]
  52. cli_server.color = On
  53. [Date]
  54. date.timezone = Asia/Shanghai
  55. [filter]
  56. [iconv]
  57. [intl]
  58. [sqlite3]
  59. [Pcre]
  60. [Pdo]
  61. [Pdo_mysql]
  62. pdo_mysql.cache_size = 2000
  63. pdo_mysql.default_socket=
  64. [Phar]
  65. [mail function]
  66. SMTP = localhost
  67. smtp_port = 25
  68. mail.add_x_header = On
  69. [SQL]
  70. sql.safe_mode = Off
  71. [ODBC]
  72. odbc.allow_persistent = On
  73. odbc.check_persistent = On
  74. odbc.max_persistent = -1
  75. odbc.max_links = -1
  76. odbc.defaultlrl = 4096
  77. odbc.defaultbinmode = 1
  78. [Interbase]
  79. ibase.allow_persistent = 1
  80. ibase.max_persistent = -1
  81. ibase.max_links = -1
  82. ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
  83. ibase.dateformat = "%Y-%m-%d"
  84. ibase.timeformat = "%H:%M:%S"
  85. [MySQLi]
  86. mysqli.max_persistent = -1
  87. mysqli.allow_persistent = On
  88. mysqli.max_links = -1
  89. mysqli.cache_size = 2000
  90. mysqli.default_port = 3306
  91. mysqli.default_socket = /usr/local/mysql/mysql.sock
  92. mysqli.default_host =
  93. mysqli.default_user =
  94. mysqli.default_pw =
  95. mysqli.reconnect = Off
  96. [mysqlnd]
  97. mysqlnd.collect_statistics = On
  98. mysqlnd.collect_memory_statistics = On
  99. [OCI8]
  100. [PostgreSQL]
  101. pgsql.allow_persistent = On
  102. pgsql.auto_reset_persistent = Off
  103. pgsql.max_persistent = -1
  104. pgsql.max_links = -1
  105. pgsql.ignore_notice = 0
  106. pgsql.log_notice = 0
  107. [bcmath]
  108. bcmath.scale = 0
  109. [browscap]
  110. [Session]
  111. session.save_handler = files
  112. session.use_strict_mode = 0
  113. session.use_cookies = 1
  114. session.use_only_cookies = 1
  115. session.name = PHPSESSID
  116. session.auto_start = 0
  117. session.cookie_lifetime = 0
  118. session.cookie_path = /
  119. session.cookie_domain =
  120. session.cookie_httponly =
  121. session.serialize_handler = php
  122. session.gc_probability = 1
  123. session.gc_divisor = 1000
  124. session.gc_maxlifetime = 1440
  125. session.referer_check =
  126. session.cache_limiter = nocache
  127. session.cache_expire = 180
  128. session.use_trans_sid = 0
  129. session.sid_length = 26
  130. session.trans_sid_tags = "a=href,area=href,frame=src,form="
  131. session.sid_bits_per_character = 5
  132. [Assertion]
  133. zend.assertions = 1
  134. [COM]
  135. [mbstring]
  136. [gd]
  137. [exif]
  138. [Tidy]
  139. tidy.clean_output = Off
  140. [soap]
  141. soap.wsdl_cache_enabled=1
  142. soap.wsdl_cache_dir="/tmp"
  143. soap.wsdl_cache_ttl=86400
  144. soap.wsdl_cache_limit = 5
  145. [sysvshm]
  146. [ldap]
  147. ldap.max_links = -1
  148. [mcrypt]
  149. [dba]
  150. [opcache]
  151. [curl]
  152. [openssl]

3.2 php-fpm.conf 

该配置文件位于 /usr/local/php/etc/php-fpm.conf.default

  1. [root@docker php]# vim php-fpm.conf
  2. #17行,删除注释符号“;”
  3. pid = run/php-fpm.pid
  4. [root@docker php]# egrep -v "^;" php-fpm.conf | egrep -v "^$"
  5. [global]
  6. pid = run/php-fpm.pid
  7. include=/usr/local/php/etc/php-fpm.d/*.conf

3.3 www.conf 

该配置文件位于 usr/local/php/etc/php-fpm.d/www.conf.default

  1. [root@docker php]# vim www.conf
  2. #2324行,修改用户和组
  3. user = nginx
  4. group = nginx
  5. #36行,修改监听IP和端口为容器IP:9000端口
  6. listen = 172.111.0.30:9000
  7. [root@docker php]# egrep -v "^;" www.conf | egrep -v "^$"
  8. [www]
  9. user = nginx
  10. group = nginx
  11. listen = 172.111.0.30:9000
  12. pm = dynamic
  13. pm.max_children = 5
  14. pm.start_servers = 2
  15. pm.min_spare_servers = 1
  16. pm.max_spare_servers = 3

4. 生成镜像 

  1. [root@docker php]# docker build -t php:lnmp .
  2. [root@docker php]# docker images
  3. REPOSITORY TAG IMAGE ID CREATED SIZE
  4. php lnmp 985842f961f1 About a minute ago 1.2GB
  5. mysql lnmp 49da8f7299af 12 minutes ago 9.98GB
  6. nginx lnmp 35a6404fcfa1 26 minutes ago 522MB
  7. centos 7 eeb6ee3f44bd 4 weeks ago 204MB

5. 启动镜像容器 

  1. [root@docker php]# docker run -itd --name php --net mynetwork --ip 172.111.0.30 -p 9000:9000 --volumes-from nginx --volumes-from mysql php:lnmp
  2. 954d8ecdd6c7d47270fe15ce4ad6db9c4a5396f42f9d111315ecee69358a9566
  3. [root@docker php]# docker ps -a
  4. CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
  5. 954d8ecdd6c7 php:lnmp "/bin/sh -c '/usr/lo…" 15 seconds ago Up 14 seconds 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp php
  6. ebafbdc1c4dc mysql:lnmp "/usr/sbin/init" 8 minutes ago Up 8 minutes 3306/tcp mysql
  7. 57616d4ea225 nginx:lnmp "/usr/local/nginx/sb…" 26 minutes ago Up 26 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp nginx

6. 验证 php 

  1. [root@docker php]# docker exec -it php bash
  2. [root@954d8ecdd6c7 php-7.1.10]# ps -aux
  3. USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
  4. root 1 0.0 0.0 113028 9536 pts/0 Ss+ 06:00 0:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
  5. nginx 7 0.0 0.0 113028 5780 pts/0 S+ 06:00 0:00 php-fpm: pool www
  6. nginx 8 0.0 0.0 113028 5784 pts/0 S+ 06:00 0:00 php-fpm: pool www
  7. root 9 0.2 0.0 11828 1888 pts/1 Ss 06:01 0:00 bash
  8. root 23 0.0 0.0 51732 1728 pts/1 R+ 06:01 0:00 ps -aux

六、启动 wordpress 服务 

1. mysql 授权

进入 mysql 容器

  1. [root@ebafbdc1c4dc bin]# mysql -u root -p
  2. Enter password:
  3. #初始密码为空
  4. mysql> create database wordpress;
  5. Query OK, 1 row affected (0.00 sec)
  6. mysql> grant all privileges on wordpress.* to 'wordpress'@'%' identified by '123456';
  7. Query OK, 0 rows affected, 1 warning (0.00 sec)
  8. mysql> grant all privileges on *.* to 'root'@'%' identified by '123456';
  9. Query OK, 0 rows affected, 1 warning (0.00 sec)
  10. mysql> flush privileges;
  11. Query OK, 0 rows affected (0.00 sec)

2. 浏览器访问测试 

访问 http://192.168.223.30/wordpress/index.php

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/492051
推荐阅读
相关标签
  

闽ICP备14008679号