一、 利用nginx镜像建立音乐播放服务器:
- 文件结构
musicserver/
├── default.conf
├── docker-compose.yml
└── mp3
├── ai mini-遇.mp3
├── Angel Girl-花木兰.mp3
├── BWO-Sunshine In The Rain.mp3
- default.conf的配置
server {
listen 80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
#打开目录列示功能
autoindex on;
#设定响应字符集
charset utf-8,gbk;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
- docker-compose.yml的内容:
version: "3"
services:
musicserver:
image: nginx
ports:
- "8000:80"
volumes:
- "$PWD/default.conf:/etc/nginx/conf.d/default.conf"
- "$PWD/mp3:/usr/share/nginx/html"
网友评论