docker-compose 方式部署wordpress
本文最后更新于 668 天前,其中的信息可能已经有所发展或是发生改变。

使用docker-compose部署wordpress个人网站。
包含数据持久化,以及nginx配置文件和ssl证书使用。
可根据个人需要更改密码等参数。
以下为docker-compose.yaml文件内容

version: "2"
services:
    db:
        image: mysql:5.7
        volumes:
            - "./data/db:/var/lib/mysql"
        ports:
            - "3306:3306"
        restart: always
        environment:
            MYSQL_ROOT_PASSWORD: wordpress
            MYSQL_DATABASE: wordpress
            MYSQL_USER: wordpress
            MYSQL_PASSWORD: wordpress
    nginx:
        image: nginx:alpine
        restart: always
        volumes:
            - ./cert:/etc/nginx/cert
            - ./conf/nginx.conf:/etc/nginx/nginx.conf
            - ./home/wordpress:/var/www/html
            - ./conf.d:/etc/nginx/conf.d
        ports:
            - "443:443"
        links:
            - wordpress
    wordpress:
        image: wordpress:4.9.4-php7.0-fpm
        ports:
            - 9000:9000
        volumes:
            - ./home/wordpress:/var/www/html
        restart: always
        environment:
            WORDPRESS_DB_NAME : wordpress
            WORDPRESS_TABLE_PREFIX : wp_
            WORDPRESS_DB_HOST : db
            WORDPRESS_DB_PASSWORD : wordpress
            WORDPRESS_DB_USER : wordpress
        depends_on:
            - db

nginx服务default.conf内容如下

server {
    listen 443;
    server_name www.yapengli.com;  #修改为自己的域名
    ssl on;
    root /var/www/html;
    index index.php index.html;
    ssl_certificate   cert/yapengli.pem;   #修改为自己的证书地址
    ssl_certificate_key  cert/yapengli.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 192.168.1.0: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;
}
}
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇