简单配置文件
worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; #配置跨域 add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Headers X-Requested-With; add_header Access-Control-Allow-Methods GET,POST,OPTIONS; location / { #代理本地文件夹 root /mymp4; autoindex on; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
代理mp4
worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; #配置跨域 add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Headers X-Requested-With; add_header Access-Control-Allow-Methods GET,POST,OPTIONS; location / { #代理本地文件夹 root /mymp4; autoindex on; #开启nginx目录浏览功能 autoindex_exact_size off; #文件大小从KB开始显示 autoindex_localtime on; #显示文件修改时间为服务器本地时间 } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
python3 搭建局域网服务器
cd 到指定目录 python -m http.server 30000
直接运行容器
#视频位于 /mymp4 中 docker run -p 10001:80 -d --name mymp4 registry.cn-hangzhou.aliyuncs.com/mkmk/conda:nginxlotsofmp4 标签 nginxlotsofmp4
直接访问 localhost:10001