久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      docker-composer快速構(gòu)建nginx+php環(huán)境

      本文由composer教程欄目給大家介紹怎么使用docker-composer構(gòu)建一個簡單nginx+php環(huán)境,希望對需要的朋友有所幫助!

      目錄結(jié)構(gòu)

      ?  Study tree ├── conf ├── docker-compose.yaml ├── nginx │   ├── conf │   │   └── laravel.conf │   └── html │       └── index.php

      index.php

      <?php /**  * Created by OrangBus  * User email: orangbus40400@gmail.com  * website: orangbus.cn  * blog: doc.orangbus.cn  * github: github.com/orangbus  */echo phpinfo();

      nginx.conf

      server {  listen       80;  server_name  localhost;   location / {  root   /usr/share/nginx/html;  index  index.html index.htm index.php;  }   error_page   500 502 503 504  /50x.html;  location = /50x.html {  root   /usr/share/nginx/html;  }   location ~ .php$ {  fastcgi_pass   php8:9000;  fastcgi_index  index.php;  fastcgi_param  SCRIPT_FILENAME  /html$fastcgi_script_name;  include        fastcgi_params;  }}

      重點說明

      fastcgi_pass   php8:9000;

      php8: php容器的名稱,如果你想配置多個php版本,只需要將php的配置復(fù)制一份就可以,填寫對應(yīng)的php容器名稱

       php8: # php的容器名稱  image: php:8.0-fpm  restart: always  volumes:  - ./nginx/html:/html--------------------------------  php74: # 對應(yīng)的nginx配置文件為:fastcgi_pass   php74:9000;  image: php:8.0-fpm  restart: always  volumes:  - ./nginx/html:/html
      fastcgi_param  SCRIPT_FILENAME  /html$fastcgi_script_name;

      /html :php項目映射到 【php 容器的目錄】(紅色)

      docker-compose

      version: '3.5'services:  nginx:  image: nginx:latest restart: always ports:  - 8010:80  volumes:  - ./nginx/html/:/usr/share/nginx/html # 注意點一  - ./nginx/conf/:/etc/nginx/conf.d/ links:  - php8 php8:  image: php:8.0-fpm restart: always volumes:  - ./nginx/html:/html #注意點二

      注意點一:

      ./nginx/html :本機你的php項目地址

      /usr/share/nginx/html: nginx默認的訪問地址

      注意點二:

      ./nginx/html :本機你的php項目地址

      /html: 這里地址是將你本地的php代碼映射到php的容器當中,一般是和你nginx配置的地址是一致的 (紅色)

      Tip:請留意兩處紅色的區(qū)域的關(guān)聯(lián),這樣一個簡單的nginx+php關(guān)聯(lián)的環(huán)境就配置成功了。

      踩坑指南:

      當使用-link 時,連接容器的自定義端口將失效,舉例

      version: '3.5'services:  php8:  image: php:8.0-fpm restart: always volumes:  - ./nginx/html:/html links: # 如果使用 links ,當我們php程序中填寫mysql端口的時候應(yīng)該是 3306 而不是 3307,但是我們外部是需要用3307端口去連接mysql的  - mysql mysql:  image: mysql:latest ports:  - 3307:3306

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號