阿里云服务器docker部署WordPress
Table of Contents
使用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条评论
一位WordPress评论者
嗨,这是一条评论。
要开始审核、编辑及删除评论,请访问仪表盘的“评论”页面。
评论者头像来自Gravatar。
bc
hello word