网站Logo 小城的博客

在Win11上搭建局域网可用的nginx下载目录

admin
1
2025-04-08

1,下载nginx安装包:

z


2,在cmd命令行中切换到nginx包的解压目录

q

3,配置nginx.conf文件

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    charset utf-8;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  logs/access.log  main;
    error_log   logs/error.log;

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;

        location / {
            root   D:/nginx/nginx-1.29.0/xinjian;   ///此目录就是你所创建的目录,即局域网中别人可以访问的目录
            autoindex on;  # Enable directory listing
            index  index.html index.htm;
        }

location /9 {
            root   D:\videoLearn;
            autoindex on;  # Enable directory listing
            index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

最后,别人只需访问你的私网IP地址即可

动物装饰