码迷,mamicode.com
首页 > 其他好文 > 详细

nginx代理内网服务器文件夹

时间:2018-07-26 10:46:58      阅读:228      评论:0      收藏:0      [点我收藏+]

标签:代理   mime   本地   keepalive   byte   stream   auto   html   time   

外网主机配置:

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

nginx代理内网服务器文件夹

标签:代理   mime   本地   keepalive   byte   stream   auto   html   time   

原文地址:http://blog.51cto.com/13172370/2150284

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!