centos7下使用Docker搭建Wordpress
搭建环境
系统:centos7
技术:Docker
搭建Wordpress需要有nginx、php、mysql
一、安装Docker
docker安装参考:https://blog.csdn.net/clover661/article/details/122226083?spm=1001.2014.3001.5501
二、拉取alpine最新镜像
alpine作为基础镜像,相比于其他 Docker 镜像,它的容量非常小,仅仅只有 5 MB 左右,目前 Docker 官方已开始推荐使用 Alpine 替代之前的centos做为基础镜像环境。这样会带来多个好处。包括镜像下载速度加快,镜像安全性提高,主机之间的切换更方便,占用更少磁盘空间等。
拉取:
[root@dockser ~]# docker pull alpine
三、编写nginx.conf文件(在docker外装个nginx,测试此配置文件能正常使用)
user daemon;
worker_processes auto;
error_log logs/error.log info;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include 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 logs/access.log main;
sendfile on;
keepalive_timeout 65;
gzip on;
server {
listen 80;
server_name localhost;
location / {
root /data/www;
index index.php index.html index.htm;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$