nginx proxy directory

Simple Profile

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;
        }

    }
}

Acting 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 set up a LAN server

cd 到指定目录
python -m http.server  30000

Run directly container

#视频位于 /mymp4 中
docker run -p 10001:80 -d --name mymp4 registry.cn-hangzhou.aliyuncs.com/mkmk/conda:nginxlotsofmp4
标签 nginxlotsofmp4

Direct access to the localhost: 10001

Published 78 original articles · won praise 2 · Views 5619

Guess you like

Origin blog.csdn.net/qq_43373608/article/details/104417895