Nginx 本地资源映射

nginx.conf 配置

 

#user  nobody;
worker_processes  1;


#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


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

	add_header Access-Control-Allow-Origin *;
	add_header Access-Control-Allow-Headers X-Requested-With;
	add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
    sendfile        on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    server {
        listen       8080;
        server_name  localhost;

        location / {
            root   html;
            index  index.html index.htm;
        }
		
		location /image{
			alias F:/faces/;		
		}
		
					
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

    }

}

启动nginx

接下来就是访问了 浏览器输入localhost:8080/image/文件名

 

Nginx 本地资源映射_第1张图片

 

 

 

你可能感兴趣的:(Nginx)