问题:
docker修改了配置文件,但是配置不生效,无法访问自己的项目
原因
根据教程,给配置文件添加server
为了添加项目、修改文件方便,我把nginx.conf
和我自定存放项目的文件夹projects
挂载到了容器外部,写配置文件时,root理所当然的路径写成了容器外的路径/docker-containers/nginx/projects/dist
,改为相对路径也不生效。应该修改为nginx容器里的路径
server {
listen 8189;
server_name 192.xxx.xx.xxx;
location / {
root /etc/nginx/projects/dist; # nginx容器内文件的位置
index index.html;
}
# ... 略