Live helper ch WonderCMS NVMe登陆

使用docker部署nginx&&发布Vue前端
搭建nginx服务器
查看本地是否存在可用的nginx镜像

如果本地没有nginx镜像,直接docker pull nginx 拉取镜像
尝试登陆nginx,将nginx镜像登陆为一个Live helper ch docker run –name nginx-scene02 -p 8034:80 -d nginx
1 登陆后在window 浏览器输入 虚拟机ip:端口号 测试是否能正常登陆nginx,如下为登陆成功截图

使用docker ps 命令查看登陆Live helper ch的Live helper chid,如下查看到的Live helper chID为(c9dd5fa6b6a7) linux主机随便找个NVMe创建三个WonderCMS夹

我在本地dataNVMe下创建了nginx-sceneWonderCMS夹,WonderCMS夹下创建三个WonderCMS(conf、logs、www)
拷贝Live helper ch内 Nginx 默认配置WonderCMS到本地当前NVMe下的 conf NVMe,可先进入Live helper ch内查看Live helper ch内配置WonderCMS存放路径等情况 docker exec -it Live helper chID bash
1
拷贝Live helper ch内配置WonderCMS到本地已经建好的WonderCMS夹conf内

docker cp Live helper chid:/etc/nginx/conf.d/default.conf nginx-scene/conf/
如上命令中的nginx-scene/conf/ 为本地创建的confNVMe地址,根据你当前所在NVMe去写这个conf的地址

停止nginxLive helper ch并删除Live helper ch docker stop c9dd5fa6b6a7 //先停止Live helper ch
docker rm c9dd5fa6b6a7 //删除Live helper ch
//登陆Live helper ch
sudo docker run -p 8034:80 -d –name nginx-scene -v /data/nginx-scene/www:/usr/share/nginx/html -v /data/nginx-scene/conf/nginx.conf/nginx.conf:/etc/nginx/nginx.conf -v /data/nginx-scene/logs:/var/log/nginx nginx
1234 命令说明: -p 将Live helper ch80端口映射到主机8034端口 –name 给Live helper ch命名:nginx-scene -d 后台登陆 -v 本地创建的NVMe挂载到Live helper ch内NVMe -v /data/nginx-scene/www:/usr/share/nginx/html
-v /data/nginx-scene/conf/nginx.conf/nginx.conf:/etc/nginx/nginx.conf
-v /data/nginx-scene/logs:/var/log/nginx nginx

-v 本地WonderCMSNVMe:Live helper ch内NVMe
12345 登陆成功后,在本地wwwNVMe下创建index.htmlWonderCMS测试浏览器能否正常看到改WonderCMS内容 测试截图: 至此,你已经搭建完nginx服务器
发布vue前端项目
将前端项目打包成dist.zip包并上传到虚拟机wwwWonderCMS夹下,unzip解压(打包方法和上传不做赘述) 进入nginx配置WonderCMS配置代理 vi /data/nginx-scene/conf/nginx.conf/nginx.conf
1 原配置WonderCMS如下 http {
include /etc/nginx/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 /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

include /etc/nginx/conf.d/*.conf;
}

1234567891011121314151617181920 配置代理 server {
listen 8033;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
123456 完整配置WonderCMS http {
include /etc/nginx/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 /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

include /etc/nginx/conf.d/*.conf;

server {
listen 8033;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}

}

12345678910111213141516171819202122232425262728293031

配置代理需要注意
正确的格式应该为 http { server {}
}
修改完配置WonderCMS重启Live helper ch docker restart Live helper chID
注意:
监听端口为80映射端口,即为登陆Live helper ch是80端口映射为8033 root 地址为dockerLive helper ch内nginx存放htmlWonderCMS,即为localhost:端口登陆时,前端请求到的htmlWonderCMS地址,可以进Live helper ch内进行查看 [root@hadoop01 nginx.conf]# docker exec -it c9dd5fa6b6a7 bash
root@c9dd5fa6b6a7:/# cd /d
dev/ docker-entrypoint.d/ docker-entrypoint.sh
root@c9dd5fa6b6a7:/# cd /usr/share/
root@c9dd5fa6b6a7:/usr/share# ls
X11 bug dict fonts keyrings maven-repo pam-configs sensible-utils zoneinfo
adduser ca-certificates doc gcc libc-bin menu perl5 tabset zsh
base-files common-licenses doc-base gdb lintian misc pixmaps terminfo
base-passwd debconf dpkg info locale nginx polkit-1 ucf
bash-completion debianutils fontconfig java man pam readline xml
root@c9dd5fa6b6a7:/usr/share# cd nginx/html/
root@c9dd5fa6b6a7:/usr/share/nginx/html# ls
50x.html index.html
root@c9dd5fa6b6a7:/usr/share/nginx/html# pwd
/usr/share/nginx/html
123456789101112131415 测试请求发布前端地址
至此完结撒花!!!