• 【WordPress】docker-compose 安装 wordpress


    mkdir /data/wordpress

    vim docker-compose.yml

    version: '3.1'
    
    services:
      wordpress:
        image: wordpress:php7.3-fpm
        restart: always
        ports:
          - "9000:9000"
        depends_on:
          - db
        environment:
          WORDPRESS_DB_HOST: db:3306
          WORDPRESS_DB_USER: wordpress
          WORDPRESS_DB_PASSWORD: FmGHHi#Jn1wQlHMc
          WORDPRESS_DB_NAME: wordpress
        volumes:
          - ./data/wp_site:/var/www/html
      db:
        image: mysql:5.7
        restart: always
        ports:
          - "8470:3306"
        environment:
          MYSQL_DATABASE: wordpress
          MYSQL_USER: wordpress
          MYSQL_PASSWORD: FmGHHi#Jn1wQlHMc
          MYSQL_RANDOM_ROOT_PASSWORD: '1'
        volumes:
          - ./data/db_data:/var/lib/mysql
      nginx:
        image: nginx
        restart: always
        volumes:
          - ./nginx/cert:/etc/nginx/cert
          - ./nginx/conf.d:/etc/nginx/conf.d
          - ./data/wp_site:/var/www/html
        ports:
          - "80:80"
          - "443:443"
        links:
          - wordpress
    

    mkdir -p nginx/{cert,conf.d}

    vim nginx/conf.d/wordpress.conf

    server {
            listen 80;
            server_name 127.0.0.1;
    
            #ssl on;
            root /var/www/html;
            index index.php index.html;
            #ssl_certificate   cert/test.pem;   #修改为自己的证书地址
            #ssl_certificate_key  cert/test.key;  #修改为自己的密钥地址
            #ssl_session_timeout 5m;
            #ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
            #ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
            #ssl_prefer_server_ciphers on;
    
            location / {
                try_files $uri $uri/ /index.php?$args;
            }
    
            location ~ .php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+.php)(/.+)$;
                fastcgi_pass wordpress:9000;   #wordpress地址
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param PATH_INFO $fastcgi_path_info;
            }
       }
    

    也可直接用官方的apache镜像;

    version: '3.1'
    
    services:
      wordpress:
        image: wordpress:latest
        restart: always
        ports:
          - "80:80"
          - "443:443"
        depends_on:
          - db
        environment:
          WORDPRESS_DB_HOST: db
          WORDPRESS_DB_USER: wordpress
          WORDPRESS_DB_PASSWORD: FmGHHi#Jn1wQlHMc
          WORDPRESS_DB_NAME: wordpress
        volumes:
          - ./wp_site:/var/www/html
      db:
        image: mysql:5.7
        restart: always
        ports:
          - "8470:3306"
        environment:
          MYSQL_DATABASE: wordpress
          MYSQL_USER: wordpress
          MYSQL_PASSWORD: FmGHHi#Jn1wQlHMc
          MYSQL_RANDOM_ROOT_PASSWORD: '1'
        volumes:
          - ./db_data:/var/lib/mysql
    
  • 相关阅读:
    Ubuntu18.04安装RTX2080Ti+NVIDIA驱动+CUDA
    G++ 编译多个源文件
    线段树【递归版本】
    Linux 安装 python 指定版本--编译源码方式
    正则表达式高级替换
    【转载】Git忽略规则和.gitignore规则不生效的解决办法
    一次“惊险”的系统修复过程
    YOLO模型对图片中车辆的识别比对
    YOLOv3模型识别车位图片的测试报告(节选)
    在windows下用python调用darknet的yolo接口
  • 原文地址:https://www.cnblogs.com/UncleZhao/p/14335846.html
Copyright © 2020-2023  润新知