• Docker 学习第三课


    搭建NGINX + PH-FPM

    1、修改NGINX配置文件

    user  nginx;
    worker_processes  auto;
    
    error_log  /var/log/nginx/error.log warn;
    pid        /var/run/nginx.pid;
    
    
    events {
        worker_connections  1024;
    }
    
    
    http {
        include       /etc/nginx/mime.types;
        default_type  application/octet-stream;
    
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';
    
        access_log  /var/log/nginx/access.log  main;
    
        sendfile        on;
        #tcp_nopush     on;
    
        keepalive_timeout  65;
    
        #gzip  on;
    
       #include /etc/nginx/conf.d/*.conf;
    
       server {
          listen 80;
    
          location / {
                root /var/www/html;
                index index.php index.html;
          }
    
    
          # php解析
          location ~ .php$ {
                root           /php;
                fastcgi_pass   192.138.0.5:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include        fastcgi_params;
          }
       }
    }

    2、启动php-fpm容器

    docker run -d --name php-fpm -v /root/php/:/php/ --network nginx-net --ip 192.138.0.6 php:7.2.0-fpm-alpine3.6

    3、启动Nginx容器

    docker run -d -p 80:80 --rm --name nginx -v /root/php/:/usr/share/nginx/html -v /root/conf/nginx.conf:/etc/nginx/nginx.conf --network nginx-net nginx:1.19.0-alpine

  • 相关阅读:
    2019年8月22日 星期四(杂谈)
    文件读写
    log4j
    java 读写 xlsx
    mongodb的增删改查
    mongodb安装与简单配置
    mondb的特性
    mongodb 的简单应用
    linux 学习1
    linux 安装MySql
  • 原文地址:https://www.cnblogs.com/qingxiaoping/p/13203212.html
Copyright © 2020-2023  润新知