Docker——部署LNMP架构

目录

一、LNMP架构概述

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.浏览器访问测试


一、LNMP架构概述

L:Linux平台,操作系统,另外桑组件的运行平台

N:nginx 提供前端页面

M:MySQL,开源关系的数据库,主要是用来保存用户账号信息。

P:PHP,开发一种动态页面的编程语言,解释解析动态页面,起到中间件的作用。(nginx和数据库的中间,沟通nginx和数据库,已请求数据库上的信息)

lnmp:企业网站的应用模式之一。早期的论坛架构就是lnmp搭建的

1.项目环境

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

2.服务器环境

容器IP地址主要软件
Nginx172.20.0.10Docker-Nginx
Mysql172.20.0.20Docker-Mysql
PHP172.20.0.30Docker-Php

3.需求

  • 使用Docker创建LNMP环境并运行Wordpress网站
  • 限制Nginx容器最多使用500MB的内存和1GB的Swap
  • 限制Mysql容器写/dev/sda的速率为10MB/s
  • 将所有容器进行,然后将Docker镜像

二、搭建Linux系统基础镜像

[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# setenforce 0
setenforce: SELinux is disabled
[root@localhost ~]# docker pull centos:7
#从公有仓库中下载 centos7 作为系统基础镜像
[root@localhost ~]#docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
centos       7         eeb6ee3f44bd   2 years ago   204MB

三、部署Nginx

1.建立工作目录

[root@localhost ~]# mkdir /opt/nginx
[root@localhost ~]# cd /opt/nginx
[root@localhost nginx]# rz -E
rz waiting to receive.
#上传 nginx 安装包 nginx-1.22.0.tar.gz
[root@docker nginx]# rz -E
rz waiting to receive.
#上传 wordpress 服务包 wordpress-6.1.1-zh_CN.zip

2.编写Dockerfile脚本

[root@localhost nginx]# vim DockerfileFROM centos:7
#用户信息
MAINTAINER this is nginx image <lnmp>
#添加环境包
RUN yum -y update
RUN yum -y install pcre-devel zlib-devel gcc gcc-c++ make
RUN useradd -M -s /sbin/nologin nginx
#上传nginx软件压缩包,并解压
ADD nginx-1.22.0.tar.gz /opt/
#指定工作目录
WORKDIR /opt/nginx-1.22.0
RUN ./configure \
--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-http_stub_status_module && make && make install
ENV PATH /usr/local/nginx/sbin:$PATH
ADD nginx.conf /usr/local/nginx/conf/
ADD wordpress-6.1.1-zh_CN.zip /usr/local/nginx/html
RUN chmod 777 -R /usr/local/nginx/html/
VOLUME [ "/usr/local/nginx/html/" ]
#指定http和https端口
EXPOSE 80
EXPOSE 443
RUN echo "daemon off;" >> /usr/local/nginx/conf/nginx.conf
#关闭 nginx 在后台运行
#添加宿主机中run.sh到容器中
ADD run.sh /run.sh
RUN chmod 755 /run.sh
CMD ["/run.sh"]
#CMD ["/usr/local/sbin/nginx", "-g", "daemon off;"]
[root@localhost nginx]#vim run.sh
[root@localhost nginx]#cat run.sh 
#!/bin/bash
/usr/local/nginx/sbin/nginx

3.准备Nginx.conf配置文件

[root@localhost nginx]# vim nginx.conf
worker_processes  1;
events {worker_connections  1024;
}
http {include       mime.types;default_type  application/octet-stream;sendfile        on;keepalive_timeout  65;server {listen       80;server_name  localhost;charset utf-8;location / {root   html;index  index.html index.php;}error_page   500 502 503 504  /50x.html;location = /50x.html {root   html;}location ~ \.php$ {root           html;fastcgi_pass   172.20.0.30:9000;fastcgi_index  index.php;fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html$fastcgi_script_name;include        fastcgi_params;}}
}

4.生成镜像

[root@localhost nginx]# docker build -t nginx:lnmp .
[root@localhost nginx]#docker images
REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
nginx        lnmp      c58b74b073a6   2 minutes ago   945MB
centos       7         eeb6ee3f44bd   2 years ago     204MB

5.创建自定义网络

[root@localhost nginx]#docker network create --subnet=172.20.0.0/16 --opt "com.docker.network.bridge.name"="docker1" mynetwork
b670bf7109003688dd5fa7c5d814527f842997d7f3dfdfcb04fc0894701e4057
[root@localhost nginx]#docker network ls
NETWORK ID     NAME        DRIVER    SCOPE
e2cc5ac53bc5   bridge      bridge    local
675fa9e17777   host        host      local
b670bf710900   mynetwork   bridge    local
280bac5f6c07   none        null      local
[root@localhost nginx]#ifconfig 
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255inet6 fe80::42:d7ff:fe17:f6c7  prefixlen 64  scopeid 0x20<link>ether 02:42:d7:17:f6:c7  txqueuelen 0  (Ethernet)RX packets 39915  bytes 1611972 (1.5 MiB)RX errors 0  dropped 0  overruns 0  frame 0TX packets 73683  bytes 138871014 (132.4 MiB)TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0docker1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500inet 172.20.0.1  netmask 255.255.0.0  broadcast 172.20.255.255

6.启动镜像容器

[root@localhost nginx]#docker run -d --name nginx -p 80:80 -m 500m --memory-swap 1g --net mynetwork --ip 172.20.0.10 nginx:lnmp
e0dbb5d14e798e1fa315ad2d58aeb530bd9dce52ed85d53e06b4ff57d5b2343c[root@localhost nginx]#docker ps
CONTAINER ID   IMAGE        COMMAND     CREATED          STATUS          PORTS                                        NAMES
e0dbb5d14e79   lnmp:nginx   "/run.sh"   15 seconds ago   Up 14 seconds   0.0.0.0:80->80/tcp, :::80->80/tcp, 443/tcp   nginx······[root@localhost nginx]# docker inspect nginx"Networks": {"mynetwork": {"IPAMConfig": {"IPv4Address": "172.20.0.10"

7.验证Nginx

[root@localhost nginx]#curl 172.20.0.10
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p><p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p><p><em>Thank you for using nginx.</em></p>
</body>
</html>

三、部署Mysql

1.建立工作目录

[root@localhost nginx]# mkdir /opt/mysql
[root@localhost nginx]# cd /opt/mysql/
[root@localhost mysql]# rz -E
rz waiting to receive.
#传入mysql安装包mysql-boost-5.7.20.tar.gz

2.编写Dockerfile

[root@localhost mysql]# vim Dockerfile FROM centos:7
MAINTAINER this is mysql image <lnmp>
RUN yum -y install ncurses ncurses-devel bison cmake pcre-devel zlib-devel gcc gcc-c++ make;useradd -M -s /sbin/nologin mysql
ADD mysql-boost-5.7.20.tar.gz /usr/local/src/
WORKDIR /usr/local/src/mysql-5.7.20/
RUN cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DSYSCONFDIR=/etc \
-DSYSTEMD_PID_DIR=/usr/local/mysql \
-DDEFAULT_CHARSET=utf8  \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DWITH_BOOST=boost \
-DWITH_SYSTEMD=1;make -j4;make install
ADD my.cnf /etc/my.cnf
EXPOSE 3306
RUN chown -R mysql:mysql /usr/local/mysql/;chown mysql:mysql /etc/my.cnf
WORKDIR /usr/local/mysql/bin/
RUN ./mysqld \
--initialize-insecure \
--user=mysql \
--basedir=/usr/local/mysql \
--datadir=/usr/local/mysql/data;cp /usr/local/mysql/usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/;systemctl enable mysqld
ENV PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH
VOLUME [ "/usr/local/mysql" ]
CMD ["/usr/sbin/init"]

3.准备my.cnf文件

[root@localhost mysql]# vim my.cnf[client]
port = 3306
socket=/usr/local/mysql/mysql.sock[mysqld]
user = mysql
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port = 3306
character-set-server=utf8
pid-file = /usr/local/mysql/mysqld.pid
socket=/usr/local/mysql/mysql.sock
bind-address = 0.0.0.0
skip-name-resolve
max_connections=2048
default-storage-engine=INNODB
max_allowed_packet=16M
server-id = 1sql_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.生成镜像

[root@docker mysql]# docker build -t mysql:lnmp .
[root@localhost mysql]#docker images
REPOSITORY   TAG       IMAGE ID       CREATED              SIZE
mysql        lnmp      e27bd3614a1d   About a minute ago   10.1GB
lnmp         nginx     a5c5710e1bf1   About an hour ago    895MB
centos       7         eeb6ee3f44bd   2 years ago          204MB

5.启动镜像容器

[root@localhost mysql]# docker run --name=mysql -d --privileged --device-write-bps /dev/sda:10M -v /usr/local/mysql --net mynetwork --ip 172.20.0.20 mysql:lnmp
d18533a527b17c3a1aacf0eb72f264c77acbe0ceb20ab23be88c7dcabe4bc52c
[root@localhost mysql]#docker ps -a
CONTAINER ID   IMAGE        COMMAND            CREATED          STATUS          PORTS                                        NAMES
d18533a527b1   mysql:lnmp   "/usr/sbin/init"   48 seconds ago   Up 32 seconds   3306/tcp                                     mysql
e0dbb5d14e79   lnmp:nginx   "/run.sh"          59 minutes ago   Up 59 minutes   0.0.0.0:80->80/tcp, :::80->80/tcp, 443/tcp   nginx

6.验证Mysql

[root@localhost mysql]#docker exec -it mysql bash
[root@d18533a527b1 bin]#  systemctl status mysqld
[root@d18533a527b1 bin]# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: activating (start) since Sun 2024-04-28 01:23:41 UTC; 1min 6s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 79 ExecStart=/usr/local/mysql/bin/mysqld --daemonize --pid-file=/usr/local/mysql/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)Process: 48 ExecStartPre=/usr/local/mysql/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)CGroup: /docker/d18533a527b17c3a1aacf0eb72f264c77acbe0ceb20ab23be88c7dcabe4bc52c/system.slice/mysqld.service└─83 /usr/local/mysql/bin/mysqld --daemonize --pid-file=/usr/l...Apr 28 01:23:44 d18533a527b1 mysqld[79]: 2024-04-28T01:23:44.992564Z 0 [....
Apr 28 01:23:44 d18533a527b1 mysqld[79]: 2024-04-28T01:23:44.993599Z 0 [....
Apr 28 01:23:44 d18533a527b1 mysqld[79]: 2024-04-28T01:23:44.993627Z 0 [....
Apr 28 01:23:44 d18533a527b1 mysqld[79]: 2024-04-28T01:23:44.997795Z 0 [...s
Apr 28 01:23:44 d18533a527b1 mysqld[79]: 2024-04-28T01:23:44.997971Z 0 [....
Apr 28 01:23:44 d18533a527b1 mysqld[79]: Version: '5.7.20'  socket: '/us...n
Apr 28 01:23:44 d18533a527b1 mysqld[79]: 2024-04-28T01:23:44.997977Z 0 [....
Apr 28 01:23:44 d18533a527b1 mysqld[79]: 2024-04-28T01:23:44.997979Z 0 [...s
Apr 28 01:23:45 d18533a527b1 systemd[1]: New main PID 83 does not belong....
Apr 28 01:23:45 d18533a527b1 systemd[1]: New main PID 83 does not belong....
Hint: Some lines were ellipsized, use -l to show in full.

四、部署Php

1.建立工作目录

[root@localhost  mysql]# mkdir ../php
[root@localhost  mysql]# cd ../php/
[root@localhost  php]# rz -E
rz waiting to receive.
#传入php安装包php-7.1.10.tar.bz2

2.编写Dockerfile

[root@localhost php]# vim Dockerfile FROM centos:7
MAINTAINER this is php image <lnmp>
RUN yum install -y gd \
libjpeg libjpeg-devel \
libpng libpng-devel \
freetype freetype-devel \
libxml2 libxml2-devel \
zlib zlib-devel \
curl curl-devel \
openssl openssl-devel \
gcc gcc-c++ make pcre-devel;useradd -M -s /sbin/nologin nginx
ADD php-7.1.10.tar.bz2 /usr/local/src/
WORKDIR /usr/local/src/php-7.1.10
RUN ./configure \
--prefix=/usr/local/php \
--with-mysql-sock=/usr/local/mysql/mysql.sock \
--with-mysqli \
--with-zlib \
--with-curl \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-openssl \
--enable-fpm \
--enable-mbstring \
--enable-xml \
--enable-session \
--enable-ftp \
--enable-pdo \
--enable-tokenizer \
--enable-zip ; make -j 4 ; make install
ENV PATH /usr/local/php/bin:/usr/local/php/sbin:$PATH
ADD php.ini     /usr/local/php/lib/
ADD php-fpm.conf /usr/local/php/etc/
ADD www.conf /usr/local/php/etc/php-fpm.d/
EXPOSE 9000
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 位置[root@localhost php]# vim php.ini#939行,取消注释,修改
date.timezone = Asia/Shanghai
#1170行,修改
mysqli.default_socket = /usr/local/mysql/mysql.sock
[root@localhost php]# egrep -v "^;" php.ini | egrep -v "^$"
[PHP]
engine = On
short_open_tag = Off
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = -1
disable_functions =
disable_classes =
zend.enable_gc = On
expose_php = On
max_execution_time = 30
max_input_time = 60
memory_limit = 128M
error_reporting = E_ALL
display_errors = On
display_startup_errors = On
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = On
html_errors = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
default_charset = "UTF-8"
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 2M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
[CLI Server]
cli_server.color = On
[Date]
date.timezone = Asia/Shanghai
[filter]
[iconv]
[intl]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[Phar]
[mail function]
SMTP = localhost
smtp_port = 25
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket = /usr/local/mysql/mysql.sock
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = On
[OCI8]
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[bcmath]
bcmath.scale = 0
[browscap]
[Session]
session.save_handler = files
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.sid_length = 26
session.trans_sid_tags = "a=href,area=href,frame=src,form="
session.sid_bits_per_character = 5
[Assertion]
zend.assertions = 1
[COM]
[mbstring]
[gd]
[exif]
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
[ldap]
ldap.max_links = -1
[mcrypt]
[dba]
[opcache]
[curl]
[openssl]

3.2编写php-fpm.conf配置文件

该配置文件位于 /usr/local/php/etc/php-fpm.conf.default[root@localhost php]# vim php-fpm.conf #17行,删除注释符号“;”
pid = run/php-fpm.pid
[root@localhost php]# egrep -v "^;" php-fpm.conf | egrep -v "^$"
[global]
pid = run/php-fpm.pid
include=/usr/local/php/etc/php-fpm.d/*.conf

3.3编写www.conf配置文件

该配置文件位于 usr/local/php/etc/php-fpm.d/www.conf.default[root@localhost php]# vim www.conf #23、24行,修改用户和组
user = nginx
group = nginx
#36行,修改监听IP和端口为容器IP:9000端口
listen = 172.20.0.30:9000
[root@localhost php]# egrep -v "^;" www.conf | egrep -v "^$"
[www]
user = nginx
group = nginx
listen = 172.20.0.30:9000
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

4.生成镜像

[root@localhost  php]# docker build -t php:lnmp .
[root@localhost php]#docker images
REPOSITORY   TAG       IMAGE ID       CREATED          SIZE
php          lnmp      145c2632ddf3   3 minutes ago    1.4GB
mysql        lnmp      e27bd3614a1d   22 minutes ago   10.1GB
lnmp         nginx     a5c5710e1bf1   2 hours ago      895MB
centos       7         eeb6ee3f44bd   2 years ago      204MB

5.启动镜像容器

[root@localhost php]# docker run -itd --name php --net mynetwork --ip 172.20.0.30 -p 9000:9000 --volumes-from nginx --volumes-from mysql php:lnmp
02254fedc4e6976998b5a60083c28af6040cdfcd3d16b2cc3a6c5dc40b0c5972
[root@localhost php]#docker ps
CONTAINER ID   IMAGE        COMMAND                   CREATED             STATUS             PORTS                                        NAMES
02254fedc4e6   php:lnmp     "/bin/sh -c '/usr/lo…"   12 seconds ago      Up 11 seconds      0.0.0.0:9000->9000/tcp, :::9000->9000/tcp    php
d18533a527b1   mysql:lnmp   "/usr/sbin/init"          20 minutes ago      Up 20 minutes      3306/tcp                                     mysql
e0dbb5d14e79   lnmp:nginx   "/run.sh"                 About an hour ago   Up About an hour   0.0.0.0:80->80/tcp, :::80->80/tcp, 443/tcp   nginx

6.验证php

[root@localhost php]# docker exec -it php bash
[root@localhost php]#docker exec -it php bash
[root@02254fedc4e6 php-7.1.10]# ps -aux
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root          1  0.0  0.4 113028  7520 pts/0    Ss+  01:43   0:00 php-fpm: m
nginx         7  0.0  0.2 113028  3772 pts/0    S+   01:43   0:00 php-fpm: p
nginx         8  0.0  0.2 113028  3772 pts/0    S+   01:43   0:00 php-fpm: p
root          9  0.1  0.1  11828  1888 pts/1    Ss   01:44   0:00 bash
root         23  0.0  0.0  51732  1728 pts/1    R+   01:44   0:00 ps -aux

五、启动Wordpress服务

1.Mysql数据库授权

[root@localhost nginx]# docker exec -it mysql bash
[root@0a4ad94e00e8 bin]# mysql -u root -p
Enter password: 
#初始密码为空
mysql> create database wordpress;
Query OK, 1 row affected (0.00 sec)mysql> grant all privileges on wordpress.* to 'wordpress'@'%' identified by '123456';
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> grant all privileges on *.* to 'root'@'%' identified by '123456';
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

2.浏览器访问测试

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/831469.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【Docker第一课】docker的基本命令和试启动容器(详细图解)

目录 知识梗概 docker的初步了解 了解docker常用命令 试开启容器&#xff08;这里演示nginx、python3和mysql&#xff09; 1、nginx容器的启动 2、python3容器的启动 docker的作用 虚拟机与容器的区别 写在前面&#xff1a; 本专栏你将了解docker一些入门知识&#xff…

如何使用 ArcGIS Pro 查找小区最近的地铁站

学习 GIS 除了可以用在工作上之外&#xff0c;还可以将其运用到生活之中&#xff0c;比如查找距离小区最近的地铁站&#xff0c;这里为大家介绍一下查找的方法&#xff0c;希望能对你有所帮助。 数据来源 教程所使用的数据是从水经微图中下载的POI数据&#xff0c;除了POI数据…

a-table 控制列的展示和隐藏

一、业务场景&#xff1a; 最近在使用 Antd-vue 组件库的时候&#xff0c;a-table需要根据不同角色的权限显示和隐藏 columns的列 为了避免大家走弯路&#xff0c;为大家整理了一下&#xff0c;粘走可以直接用的那种 二、具体实现步骤&#xff1a; 1.在需要显示与隐藏的列增加一…

Git客户端(TortoiseGit)使用详解

1.概述 使用TortoiseGit比直接使用git 客户端和命令实现代码版本管理更为方便&#xff0c;本文根据实际使用情况作一些记录&#xff0c;特别是对于解决冲突的处理。 2.Git安装与配置 下载 Git - Downloads&#xff0c; 可参考Git安装步骤完成Git的安装与配置。 3.TortoiseG…

python学习笔记B-20:序列实战--处理千年虫

将2位数表达的年份&#xff0c;转换为用4位数表达&#xff1a; print("将列表中的2位数年份转换为4位数年份") lst[88,89,90,00,99] print(lst) for index in range(len(lst)):if len(str(lst[index]))2:lst[index] 1900int(lst[index])elif len(str(lst[index]))1…

收单外包机构备案情况分析,广东备案机构遥遥领先

孟凡富 4月30日&#xff0c;中国支付清算协会公示了最新一批收单外包服务备案机构&#xff0c;较上期增加了689家。其中&#xff0c;新增聚合支付技术服务备案机构达6家。截至4月末&#xff0c;备案的收单外包服务机构总数为27714家&#xff0c;同时取消了330家机构的备案资格&…

spring-security 学习笔记一 --- 基于默认配置

1.前言 本文主要讲解 spring-security 在不做任何配置情况下&#xff0c;它的启动流程和认证过程。 1. 准备工作 这里是基于springboot 2.2.5版本对应 spring-security 5.2.2版本演示的 &#xff08;按我下面导入即可&#xff0c;版本是它自己匹配的&#xff09; 引入依赖 &…

SpringBoot-@Transactional注解失效

Transactional注解失效 Transactional失效场景 以下是一些常见导致Transactional注解失效的场景&#xff0c;配合相应的Java代码演示&#xff1a; 1、方法修饰符非公开&#xff08;非public&#xff09; Transactional注解失效的原因在于Spring事务管理器如何实现对事务的代…

【跟马少平老师学AI】-【神经网络是怎么实现的】(七-2)word2vec模型

一句话归纳&#xff1a; 1&#xff09;CBOW模型&#xff1a; 2c个向量是相加&#xff0c;而不是拼接。 2&#xff09;CBOW模型中的哈夫曼树&#xff1a; 从root开始&#xff0c;向左为1&#xff0c;向右为0。叶子结点对应词有中的一个词。每个词对应唯一的编码。词编码不等长。…

Redis基本數據結構 ― String

Redis基本數據結構 ― String 介紹常用命令範例1. 為字串鍵設值/取得字串鍵的值2. 查看字串鍵的過期時間3. 如何為key設置時間?4. 如何刪除指定key?5. 如何增加value的值?6. 獲取value值的長度 介紹 字串鍵是Redis中最基本的鍵值對類型&#xff0c;這種類型的鍵值對會在數據…

Spring - 10 ( 9000 字 Spring 入门级教程 )

一&#xff1a;MyBatis 进阶 动态 SQL 是 Mybatis 的强大特性之⼀&#xff0c;能够完成不同条件下不同的 sql 拼接。 1.1 if 标签 在注册用户的时候&#xff0c;可能会有这样⼀个问题&#xff0c;如下图所示&#xff1a; 注册分为两种字段&#xff1a;必填字段和非必填字段&…

Vue ui 创建vue项目,详细使用攻略。

1.安装及启动 1.1 Vue ui 使用前提是全局安装vue.js 命令如下 npm install vue -g 1.2 安装过Vue.js 之后 随便在自己系统的一个地方打开命令面板 1.3 使用命令启动vue ui面板创建项目 vue ui 如图运行后显示这种就是启动成功&#xff0c;成功之后会弹出页面或者直接访问你的…

伦敦金的交易时间段都适合投资吗?

是所有的交易时间段都适合投资。首先&#xff0c;让我们了解伦敦金的交易时间。伦敦金市场的交易时间分为两个主要时段&#xff1a;亚洲盘和欧美盘。亚洲盘通常在北京时间早晨6点至下午5点半左右&#xff0c;而欧美盘则从北京时间晚上8点半开始&#xff0c;一直到次日早晨4点半…

痉挛性斜颈患者早上运动还是下午运动更合适?选对了让治疗更简单!【北京仁爱堂】

对于痉挛性斜颈患者来说&#xff0c;选择合适的运动时间对于治疗的效果和舒适度至关重要。那么&#xff0c;痉挛性斜颈患者早上运动还是下午运动更合适呢&#xff1f;本文将从多个角度对此进行分析&#xff0c;帮助患者找到最适合自己的运动时间。 首先&#xff0c;我们需要了…

特征提取(Feature Extraction)常见统计特征笔记(三)

统计特征是描述数据集中值的一组量&#xff0c;通常用于了解数据的分布、集中趋势和变异程度。常见的统计特征包括均值、中位数、众数、标准差、方差等。下面会详细解释每个统计特征&#xff0c;并给出相应的Python代码。 1、均值&#xff08;Mean&#xff09;&#xff1a;所有…

Python的使用

1、打印&#xff1a;print&#xff08;‘hello’&#xff09; 2、Python的除法是数学意义上的除法 print&#xff08;2/3&#xff09; 输出&#xff1a;0.6666... 3、a18 a‘hello’ print(a) 可以直接输出 4、**2 表示2的平方 5、打印类型 print&#xff08;type&am…

答案自在你心——不求事事皆如愿,只求件件都无悔

时光荏苒&#xff0c;弹指间&#xff0c;似如梦初醒般又迎来了大学的第二个五一假期。多数人看来&#xff0c;又是一个千载难逢的度假时光&#xff0c;于我而言&#xff0c;心里却一直紧绷一根迟迟难以松弛的弦。也许是习惯了平常忙忙碌碌的生活节奏&#xff0c;突然停下来&…

linux下载压缩包

比如我要下载的压缩包地址为&#xff1a; http://calvin.inf.ed.ac.uk/wp-content/uploads/data/cocostuffdataset/cocostuff-10k-v1.1.zip 1.创建文件夹并切换到这个目录下 2.用wget获取压缩包 压缩包下好了 3.解压 如果是 tar.gz包解压 tar -zxvf 也可以解压到具体的目录…

手撸Mybatis(一)——代理mapper

引言 最近刚写完毕设&#xff0c;闲来无事&#xff0c;看到网上有一个手撸Mybatis的教程&#xff0c;于是想自己实现一个简易版的Mybatis。 本专栏的源码&#xff1a;https://gitee.com/dhi-chen-xiaoyang/yang-mybatis。 创建简单的映射器代理工厂 在使用mybatis的时候&…

Python语言在地球科学中地理、气象、气候变化、水文、生态、传感器等数据可视化到常见数据分析方法的使用

Python是功能强大、免费、开源&#xff0c;实现面向对象的编程语言&#xff0c;Python能够运行在Linux、Windows、Macintosh、AIX操作系统上及不同平台&#xff08;x86和arm&#xff09;&#xff0c;Python简洁的语法和对动态输入的支持&#xff0c;再加上解释性语言的本质&…