未分类

阿里云服务器docker部署WordPress

使用docker部署

version: '3.5'
services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: 密码
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: 密码
   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     ports:
       - "23333:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: 密码
       WORDPRESS_DB_NAME: wordpress
volumes:
    db_data: {}

http://39.105.114.223:23333/wp-admin/

域名相关配置

一定要在wp设置里修改站点位置!!!不然重定向全是ip不是域名。

nginx反向代理隐藏端口号(23333:80)

apt install nginx
http{
      server {
                listen 80;
                server_name www.beichen.world;
                location / {
                        proxy_pass http://www.beichen.world:23333/;
                        #proxy_set_header Host $host:$server_port;

                        proxy_set_header Host $http_host;
                        proxy_set_header X-Real-IP $remote_addr;
                        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                }

        }

}

2条评论

留言

您的邮箱地址不会被公开。 必填项已用 * 标注