nginx代理内网服务器文件夹

外网主机配置:

#user  nobody;
worker_processes  1;

events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;

    keepalive_timeout  100;

    server {
        listen 7070;
        server_name localhost;

        location ^~ /hyjgpt { 
        proxy_pass        http://192.168.13.106:7878/;     
    }
         location ^~ /picture { 
        proxy_pass http://IP:端口/;
    }

         location ^~ /video { 
        proxy_pass http://IP:端口/;
    }
        location ^~ /img/ {
            root     D:/Can_jpg;
        }
        location / {
            root   html;
            index  index.html index.htm;
            proxy_pass        http://192.168.13.106:7070;         
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }      
    }

}

内网机器配置:

worker_processes  1;

events {
    worker_connections  1024;
}

http {
        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;

        sendfile            on;
        tcp_nopush          on;
        #文件服务器
        server {
        listen 82;
        server_name 本地IP;
        charset utf-8,gbk;
        root /mnt/picture;
        location / {
            autoindex on;
            autoindex_exact_size on;
            autoindex_localtime on;     
        }
        }
        server {
        listen 83;
        server_name 本地IP;
        charset utf-8,gbk;
        root /mnt/video;
        location / {
            autoindex on;
            autoindex_exact_size on;
            autoindex_localtime on;     
        }
        }
}
相关文章
相关标签/搜索