内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

docker-compose部署LNMP

實(shí)驗(yàn)前準(zhǔn)備:
下載:
[root@localhost ~]# curl -L https://github.com/docker/compose/releases/download/1.25.1-rc1/docker-compose-`uname -s-uname -m` -o /usr/local/bin/docker-compose
[root@localhost ~]# chmod +x /usr/local/bin/docker-compose
[root@localhost ~]# docker-compose -v
docker-compose version 1.25.1-rc1, build d92e9bee

專注于為中小企業(yè)提供成都網(wǎng)站建設(shè)、網(wǎng)站制作服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)霞山免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了上1000家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

//導(dǎo)入鏡像
[root@localhost?~]#?docker??load???<??nginx.tar??&&??docker??load?<??php.7.2-fpm.tar??&&??docker?load??<??MySQL-5.7.tar?

//復(fù)制配置文件
[root@localhost ~]# mkdir -p compose-lnmp/docker/
[root@localhost ~]# cd compose-lnmp/
[root@localhost compose-lnmp]# mkdir wwwroot

[root@localhost?~]#?docker?run??-itd??--name??test??nginx:latest??[root@localhost?~]#?docker??cp??test:/etc/nginx??/root/compose-lnmp/docker/??
br/>[root@localhost?~]#?docker??cp??test:/etc/nginx??/root/compose-lnmp/docker/??
br/>[root@localhost?~]#?vim??/root/compose-lnmp/wwwroot/html/index.html??
hello??LNMP!??

//添加php測試界面[root@localhost?~]#?vim??/root/compose-lnmp/wwwroot/html/test.php??
br/>[root@localhost?~]#?vim??/root/compose-lnmp/wwwroot/html/test.php??
<?php??
phpinfo();??
?>??

//設(shè)置tab鍵的空格數(shù)量[root@localhost?~]#?vim??.vimrc??
br/>[root@localhost?~]#?vim??.vimrc??
br/>[root@localhost?~]#?cat?.vimrc???

//編寫docker-compose.yml文件[root@localhost?~]#?cd??/root/compose-lnmp/??
br/>[root@localhost?~]#?cd??/root/compose-lnmp/??
version: "3.1"
services:
nginx:
container_name: nginx
image: nginx
networks:
lnmp:
ipv4_address: 172.16.10.10
restart: always
ports:

  • 80:80
    volumes:
  • /root/compose-lnmp/wwwroot/html:/usr/share/nginx/html
  • /root/compose-lnmp/docker/nginx:/etc/nginx
    mysql:
    container_name: mysql
    image: mysql:5.7
    networks:
    lnmp:
    ipv4_address: 172.16.10.20
    restart: always
    ports:
  • 3306:3306
    environment:
    MYSQL_ROOT_PASSWORD: 123.com
    php:
    container_name: phpfpm
    image: php:7.2-fpm
    networks:
    lnmp:
    ipv4_address: 172.16.10.30
    restart: always
    ports:
  • 9000:9000
    volumes:
  • /root/compose-lnmp/wwwroot/html:/usr/share/nginx/html
    networks:
    lnmp:
    driver: bridge
    ipam:
    config:
    • subnet: 172.16.10.0/24

[root@localhost ~]# echo net.ipv4.ip_forward = 1 >> /etc/sysctl.conf
[root@localhost ~]# systemctl restart network

[root@localhost?compose-lnmp]#?docker-compose??up??-d??

//修改nginx配置文件,nginx和php連接[root@localhost?compose-lnmp]#?cd??docker/nginx/conf.d/??
br/>[root@localhost?compose-lnmp]#?cd??docker/nginx/conf.d/??
10行:?
???location?/?{??
????????root???/usr/share/nginx/html;??
???????index??index.html?index.htm?index.php;??//添加php解析??
}??
//打開此模塊,并更改相應(yīng)信息:
30行:????
location?~?.php$?{??
????????root???????????/usr/share/nginx/html;??
????????fastcgi_pass???172.16.10.30:9000;??
????????fastcgi_index??index.php;??
????????fastcgi_param??SCRIPT_FILENAME??$document_root$fastcgi_script_name;??
????????include????????fastcgi_params;??
}??
//重啟
[root@localhost?conf.d]#?docker-compose??restart??

//php和mysql連接[root@localhost?compose-lnmp]#?cd??wwwroot/html/??
br/>[root@localhost?compose-lnmp]#?cd??wwwroot/html/??
[root@localhost?html]#?mv??phpMyAdmin-4.9.1-all-languages??phpmyadmin??

//更改nginx配置文件[root@localhost?compose-lnmp]#?cd??docker/nginx/conf.d/??
br/>[root@localhost?compose-lnmp]#?cd??docker/nginx/conf.d/??
//在27行添加
location??/phpmyadmin?{??
????root??/usr/share/nginx/html;??
????index???index.html??index.htm??index.php;?
}?
//在43行添加
location?~?/phpmyadmin/(?<after_ali>(.*).(php|php5)?$)?{??
????root???????????/usr/share/nginx/html;??
????fastcgi_pass???172.16.10.30:9000;??
????fastcgi_index??index.php;??
????fastcgi_param??SCRIPT_FILENAME??$document_root$fastcgi_script_name;??
????include????????fastcgi_params;??
}??

//重啟
[root@localhost?conf.d]#?docker-compose??restart??

//需要對(duì)php鏡像做出更改,添加php和mysql連接的模塊寫一個(gè)Dockerfile
[root@localhost?~]#?vim??Dockerfile??
br/>寫一個(gè)Dockerfile
[root@localhost?~]#?vim??Dockerfile??
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
&& docker-php-ext-install -j$(nproc) iconv \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd \
&& docker-php-ext-install mysqli pdo pdo_mysql
[root@localhost?~]#?docker?build??-t??phpmysql??.??

//刪除容器,更改docker-compose.yml文件,并重新運(yùn)行[root@localhost?compose-lnmp]#?docker-compose??stop??
br/>[root@localhost?compose-lnmp]#?docker-compose??stop??
br/>[root@localhost?compose-lnmp]#?vim??docker-compose.yml?
image:?phpmysql??
[root@localhost?compose-lnmp]#?docker-compose??up??-d??

//修改phpmyadmin的配置文件,指定連接數(shù)據(jù)庫的IP,然后重啟[root@localhost?compose-lnmp]#?cd??wwwroot/html/phpmyadmin/??
br/>[root@localhost?compose-lnmp]#?cd??wwwroot/html/phpmyadmin/??
br/>[root@localhost?phpmyadmin]#?vim??config.inc.php??
[root@localhost?phpmyadmin]#?cd??-??
br/>$cfg['Servers'][$i]['host']?=?'172.16.10.20';??
[root@localhost?phpmyadmin]#?cd??-??
[root@localhost?compose-lnmp]#?docker-compose??restart??

//再次訪問
用戶名:root
密碼:123.com

網(wǎng)頁標(biāo)題:docker-compose部署LNMP
鏈接地址:http://m.rwnh.cn/article2/gspcoc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供關(guān)鍵詞優(yōu)化、App開發(fā)、微信公眾號(hào)、網(wǎng)站內(nèi)鏈、軟件開發(fā)、服務(wù)器托管

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

手機(jī)網(wǎng)站建設(shè)
定州市| 巢湖市| 库车县| 龙海市| 济源市| 二连浩特市| 中山市| 天水市| 淮滨县| 荥经县| 泸定县| 西充县| 南投市| 巧家县| 民乐县| 巢湖市| 永清县| 海门市| 瓦房店市| 绿春县| 盐源县| 高清| 岚皋县| 贵定县| 江西省| 漠河县| 永泰县| 沙湾县| 广南县| 鄱阳县| 蕲春县| 龙泉市| 高密市| 禄丰县| 疏附县| 芮城县| 化隆| 布尔津县| 汉中市| 邵东县| 绍兴市|