九色国产,午夜在线视频,新黄色网址,九九色综合,天天做夜夜做久久做狠狠,天天躁夜夜躁狠狠躁2021a,久久不卡一区二区三区

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
docker部署lnmp-wordpress的實(shí)現(xiàn)步驟
目錄
· 一、實(shí)驗(yàn)環(huán)境
· 二、安裝docker源
· 三、安裝docker
· 四、部署Nginx和PHP
· 1、上傳/解壓軟件包和配置文件
· 2、創(chuàng)建dockerfile文件
· 3、構(gòu)建鏡像
· 4、創(chuàng)建容器并運(yùn)行
· 5、開啟服務(wù)
· 五、部署MySQL
· 1、創(chuàng)建MySQL的dockerfile文件
· 2、構(gòu)建鏡像
· 3、創(chuàng)建容器并運(yùn)行
· 4、啟動服務(wù)
· 5、數(shù)據(jù)庫授權(quán)
一、實(shí)驗(yàn)環(huán)境
系統(tǒng):centos7 ip:192.168.238.133
1
2
3
4
5
6
7
8
9
10
#關(guān)閉防火墻
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# setenforce 0
#添加dns
[root@localhost ~]# cat /etc/resolv.conf
nameserver 114.114.114.114
#修改主機(jī)名
[root@localhost ~]# hostnamectl set-hostname docker-lnmp
[root@localhost ~]# su
二、安裝docker源
1
2
3
4
#安裝依賴環(huán)境
[root@docker-lnmp ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
#安裝阿里docker源
[root@docker-lnmp ~]# yum-config-manager --add-repohttps://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
三、安裝docker
1
2
3
4
5
6
7
8
[root@docker-lnmp ~]# yum install -y docker-ce #安裝社區(qū)版
[root@docker-lnmp ~]# systemctl enable docker #設(shè)置開機(jī)自啟
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
[root@docker-lnmp ~]# systemctl start docke #開啟服務(wù)
#創(chuàng)建dockerfile目錄
[root@docker-lnmp ~]# mkdir docker && cd docker
#創(chuàng)建MySQL和Nginx的dockerfile目錄
[root@docker-lnmp docker]# mkdir nginx mysql
四、部署Nginx和PHP
1、上傳/解壓軟件包和配置文件
1
2
3
4
5
#解壓軟件包
[root@docker-lnmp nginx]# tar zxvf wordpress-4.9.4-zh_CN.tar.gz
[root@docker-lnmp nginx]# tar zxvf nginx-1.12.2.tar.gz
[root@docker-lnmp nginx]# tar zxvf libmcrypt-2.5.7.tar.gz
[root@docker-lnmp nginx]# tar zxvf php-5.5.38.tar.gz
2、創(chuàng)建dockerfile文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
[root@docker-lnmp nginx]# vim Dockerfile
FROM docker.io/centos:7
RUN yum -y update
RUN yum -y install gcc gcc-c++ openssl-devel openssl autoconf cmake autoconf zlib zlib-devel libtool pcre pcre-devel wget net-tools make
RUN groupadd  -g 900 nginx && useradd nginx -g nginx -s /sbin/nologin
FROM docker.io/centos:7
RUN yum -y update
RUN yum -y install gcc gcc-c++ openssl-devel openssl autoconf cmake autoconf zlib zlib-devel libtool pcre pcre-devel wget net-tools make
RUN groupadd  -g 900 nginx && useradd nginx -g nginx -s /sbin/nologin
ADD nginx-1.12.2 nginx-1.12.2
RUN cd /nginx-1.12.2/ && ./configure --prefix=/usr/local/nginx --with-http_dav_module  --with-http_stub_status_module --with-http_addition_module --with-http_sub_module --with-http_flv_module --with-http_mp4_module --with-http_ssl_module --with-http_gzip_static_module --user=nginx --group=nginx
RUN cd /nginx-1.12.2/ && make && make install
RUN ln -s /usr/local/nginx/sbin/nginx  /usr/local/sbin/
RUN sed -i '1afastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;' /usr/local/nginx/conf/fastcgi_params
ADD nginx.conf /usr/local/nginx/conf/
ADD wordpress /usr/local/nginx/html/wordpress
ADD wp-config.php /usr/local/nginx/html/wordpress
RUN yum -y install gcc gcc-c++ libxml2-devel libcurl-devel openssl-devel bzip2-devel  openssl automake make autoconf libtool zlib-devel make pcre-devel wget net-tools
ADD libmcrypt-2.5.7 libmcrypt-2.5.7
RUN cd libmcrypt-2.5.7/&& ./configure --prefix=/usr/local/libmcrypt && make && make install
ADD php-5.5.38 php-5.5.38
RUN cd php-5.5.38/ && ./configure --prefix=/usr/local/php5.5 --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --enable-fpm --enable-sockets --enable-sysvshm --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --with-mhash --with-mcrypt=/usr/local/libmcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts && make && make install
RUN cd php-5.5.38 && cp php.ini-production /etc/php.ini
RUN cd /php-5.5.38 && cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
RUN chmod +x /etc/init.d/php-fpm && chkconfig --add php-fpm && chkconfig php-fpm on
RUN cp /usr/local/php5.5/etc/php-fpm.conf.default  /usr/local/php5.5/etc/php-fpm.conf
RUN sed -i 's*;pid = run/php-fpm.pid*pid = run/php-fpm.pid*g' /usr/local/php5.5/etc/php-fpm.conf
RUN sed -i 's/user = nobody/user = nginx/g' /usr/local/php5.5/etc/php-fpm.conf
RUN sed -i 's/group = nobody/group = nginx/g' /usr/local/php5.5/etc/php-fpm.conf
RUN sed -i 's/pm.max_children = 5/pm.max_children = 50/g' /usr/local/php5.5/etc/php-fpm.conf
RUN sed -i 's/pm.start_servers = 2/pm.start_servers = 5/g' /usr/local/php5.5/etc/php-fpm.conf
RUN sed -i 's/pm.min_spare_servers = 1/pm.min_spare_servers = 5/g' /usr/local/php5.5/etc/php-fpm.conf
RUN sed -i 's/pm.max_spare_servers = 3/pm.max_spare_servers = 30/g' /usr/local/php5.5/etc/php-fpm.conf
EXPOSE 9000
EXPOSE 80
3、構(gòu)建鏡像
1
[root@docker-lnmp nginx]# docker build -t "centos:nginx-php" .
查看鏡像列表
4、創(chuàng)建容器并運(yùn)行
1
2
[root@docker-lnmp nginx]# docker run -dit -p 80:80 -m 500m --memory-swap 1G 3efb4e2c79b5 /bin/bash
49c5b69ce7012579f4b024ef6be88ff5de8057ccc7f81583fcf04f1c3ec6a79c
查看容器列表
5、開啟服務(wù)
1
2
3
4
5
6
[root@docker-lnmp nginx]# docker exec -it 49c5b69ce701 /bin/bash
[root@49c5b69ce701 /]# /etc/init.d/php-fpm start && nginx
[root@49c5b69ce701 /]# netstat -antp | grep php
tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      32/php-fpm: master
[root@49c5b69ce701 /]# netstat -antp | grep nginx
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      39/nginx: master pr
驗(yàn)證一下:
五、部署MySQL
1、創(chuàng)建MySQL的dockerfile文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@docker-lnmp mysql]# vim Dockerfile
FROM docker.io/centos:7
RUN yum -y install gcc gcc-c++ make autoconf make cmake wget
RUN groupadd mysql; useradd -r -M -u 3306 -s /sbin/nologin -g mysql mysql
RUN mkdir /usr/local/mysql; mkdir /data/mysql -pv
RUN yum install gcc gcc-c++ ncurses-devel bison bison-devel -y
RUN wget -c http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.29.tar.gz
RUN tar xf mysql-5.6.29.tar.gz -C /usr/local/src/
WORKDIR /usr/local/src/mysql-5.6.29
RUN cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc -DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DDEFAULT_CHARSET=utf8 -DEXTRA_CHARSETS=all -DDEFAULT_COLLATION=utf8_general_ci -DWITH-MYSQLD-LDFLAGS=-all-static -DWITH-CLIENT-LD-FLAGS=-all-static -DWITH_DEBUG=0 && gmake && gmake install
RUN chown -R root:mysql /usr/local/mysql/ && chown -R mysql:mysql /data/mysql
RUN chmod 755 /usr/local/src/mysql-5.6.29/scripts/mysql_install_db.sh
RUN /usr/local/src/mysql-5.6.29/scripts/mysql_install_db.sh --basedir=/usr/local/mysql --datadir=/data/mysql --no-defaults --user=mysql
RUN cp /usr/local/src/mysql-5.6.29/support-files/my-default.cnf  /etc/my.cnf
RUN cp /usr/local/src/mysql-5.6.29/support-files/mysql.server  /etc/init.d/mysqld
RUN chmod 775 /etc/init.d/mysqld && /etc/init.d/mysqld start
RUN echo -e '#!/bin/bash\nexport PATH=$PATH:/usr/local/mysql/bin' >/etc/profile.d/mysql.sh
RUN source /etc/profile
EXPOSE 3306
2、構(gòu)建鏡像
1
[root@docker-lnmp mysql]# docker build -t "centos:mysql-5.6" .
查看鏡像列表
3、創(chuàng)建容器并運(yùn)行
1
2
[root@docker-lnmp mysql]# docker run -dit -p 3306:3306 --device-write-bps /dev/sda:10M 704e5b978518 /bin/bash
960645a296e3e8795c344a8037b0641f8b5baf8e2214453214359071480c379d
查看容器列表
4、啟動服務(wù)
1
2
3
[root@docker-lnmp mysql]# docker exec -it 960645a296e3 /bin/bash
[root@960645a296e3 mysql-5.6.29]# /etc/init.d/mysqld start
Starting MySQL............ SUCCESS!
5、數(shù)據(jù)庫授權(quán)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#修改密碼
[root@960645a296e3 mysql-5.6.29]# mysql -uroot -p123456
Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@960645a296e3 mysql-5.6.29]# mysqladmin -u root -p password
Enter password:
New password:
Confirm new password:
#授權(quán)
[root@960645a296e3 mysql-5.6.29]# mysql -uroot -p123456
mysql> create database wordpress default charset utf8 COLLATE utf8_general_ci; #創(chuàng)建wordpress表
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on wordpress.*  to 'wordpress'@'%' identified by '123456' with grant option; #授權(quán)
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges; #刷新權(quán)限
Query OK, 0 rows affected (0.01 sec)
訪問:http://192.168.238.133/wordpress/index.php
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
docker部署LNMP架構(gòu)
yum安裝nginx-mysql-php-fastcgi構(gòu)建LNMP服務(wù)器
lnmp環(huán)境快速搭建及原理解析
阿里云騰訊云服務(wù)器手動配置WordPress網(wǎng)站教程
LNMP環(huán)境搭建(linux+Nginx + Mysql + PHP)
linux入門系列20--Web服務(wù)之LNMP架構(gòu)實(shí)戰(zhàn)
更多類似文章 >>
生活服務(wù)
熱點(diǎn)新聞
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服