nginx
1、nginx容器的html在目录:/usr/share/nginx/html
2、nginx.conf在容器默认位置:/etc/nginx/nginx.conf
nginx.conf需要
server {
location / {
root /usr/share/nginx/dist;
}
}
注意root需要写绝对路径
root 设置的是 location 匹配访问路径的上一层目录,location后面的/是匹配规则。
docker run 挂载项目文件夹dist到容器内的/usr/share/nginx/dist,
如果将配置文件-v到/etc/nginx/nginx.conf,则无需以配置文件启动
完整docker run:docker run --name nginx -p 80:80 -v /opt/nginx/dist/:/usr/share/nginx/dist -v /opt/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -d 镜像id
3、nginx的/etc/nginx/nginx.conf的http内include /etc/nginx/conf.d/*.conf;即
在/etc/nginx/有conf.d目录,即nginx.conf把server部分拆到conf.d目录下,此目录下存放虚拟主机的配置文件,参考:https://www.cnblogs.com/fps2tao/p/9958009.html
4、采用更改挂载到外面的文件更新方式,需要重启nginx容器
tomcat
日志位置:/usr/local/tomcat/logs
创建容器:docker run --name tomcat8.5.70 -p 8080:8080 -v /opt/docker/tomcat/logs:/usr/local/tomcat/logs -v /opt/docker/tomcat/conf:/usr/local/tomcat/conf -d 镜像id