<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                >[info] 構建 lnmp 項目 php7.4 下載: https://www.php.net/distributions/php-7.4.33.tar.gz nginx 1.22.0 下載: https://nginx.org/download/nginx-1.22.0.tar.gz mysql 5.7 下載: https://downloads.mysql.com/archives/community/ https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.40-el7-x86_64.tar.gz >[info] 建立工作目錄 ```console mkdir -p /home/{nginx,php,mysql} ``` >[info] 構建 自定義 network ```console docker network create --driver bridge --subnet=172.18.0.0/16 --gateway=172.18.0.1 mynet-lnmp ``` ![](https://img.kancloud.cn/b9/e8/b9e88ac219ab2ccae4716627c3bda9c4_760x181.png) >[info] Nginx 1. 編寫Dockerfile配置文件(盡可能把命令放在一行,減少鏡像層數,縮小鏡像內存) ~~~ # 從 centos 鏡像中構建應用 FROM centos:7 # 設置鏡像的制作者 MAINTAINER wangqianshun<420029810@qq.com # 安裝相關依賴 RUN yum install -y gcc gcc-c++ make gd-devel pcre-devel zlib-devel libxml2-devel libcurl-devel libjpeg-devel libpng-devel openssl-devel;useradd -M -s /sbin/nologin nginx # 上一條命令安裝nginx和fpm # nginx 默認安裝路徑 /etc/nginx/ # php-fpm 默認安裝路徑 /etc/php/fpm/ # nginx配置文件存放目錄 /etc/nginx/conf.d/ # nginx默認項目路徑 /var/www/html/(/usr/share/nginx/html) # 添加 nginx 壓縮包 自動解壓 ADD ./tmp/tar/nginx-1.22.0.tar.gz /usr/local/src # 工作目錄 WORKDIR /usr/local/src/nginx-1.22.0 # nginx編譯安裝 RUN ./configure \ --prefix=/usr/local/nginx \ --user=nginx \ --group=nginx \ --with-http_stub_status_module;make -j 2 && make install # nginx sbin路徑 ENV PATH /usr/local/nginx/sbin:$PATH # 復制nginx配置文件 COPY ./config/nginx.conf /usr/local/nginx/conf/default.conf # 網站項目目錄 COPY ./html/ /usr/local/nginx/html/ # 設置項目權限 刪除解壓編譯安裝的文件夾 RUN chmod 777 -R /usr/local/nginx/html/ && rm -rf /usr/local/src/nginx-1.22.0 # 暴露端口 EXPOSE 80 # 聲明了容器中的目錄作為匿名卷,但是并沒有將匿名卷綁定到宿主機指定目錄的功能。 VOLUME [ "/usr/local/nginx/html/" ] # 容器運行時啟動應用 CMD [ "/usr/local/nginx/sbin/nginx","-g","daemon off;" ] ~~~ 2. 編寫 `nginx.conf` ~~~console 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 /usr/local/nginx/html; index index.php index.html; } location ~ \.php$ { fastcgi_pass 192.168.244.10:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } } ~~~ 3. 通過 `Dockerfile` 構建鏡像 ``` docker build -f Dockerfile -t nginx:lnmp . ``` ![](https://img.kancloud.cn/f7/0b/f70bbdc627f2a29ad58e7e94c4917349_1018x130.png) 4. 啟動容器 ``` # 啟動nginx容器并且為容器指定IP地址 docker run -d --name nginx -p 80:80 -v /home/docker/lnmp/nginx/config:/usr/local/nginx/conf --net mynet-lnmp --ip 172.110.0.10 nginx:lnmp docker run -itd --name nginx -p 80:80 -v /home/nginx/html:/usr/share/nginx/html -v /home/nginx/conf/default.conf:/etc/nginx/conf.d/default.conf nginx:1.18 ``` ``` docker rm -f $(docker ps -aq) docker stop nginx && docker rm nginx && docker rmi nginx:lnmp docker run -itd --name nginx nginx:lnmp && docker exec -it nginx /bin/bash ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看