Nginx静态资源访问配置

我的Nginx配置所在CentOS6.8上的路径
/usr/local/nginx/conf/conf.d/odboy.cn.conf
upstream tian-sso-web-main {
	server 192.168.178.110:8081 weight=10;
}
server {
	listen       80;
	server_name www.odboy.cn;
	access_log  logs/www_odboy_access.log  main;
	location ~/tian-sso-web-main {
		proxy_pass http://tian-sso-web-main;
		proxy_redirect off;
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $remote_addr;
		proxy_set_header X-Forwarded-Host $server_name;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		client_max_body_size 50m;
		client_body_buffer_size 128k;
		proxy_connect_timeout 90;
		proxy_send_timeout 90;
		proxy_read_timeout 90;
		proxy_buffer_size 4k;
		proxy_buffers 4 32k;
		proxy_busy_buffers_size 64k;
		proxy_temp_file_write_size 64k ;
		proxy_headers_hash_max_size 51200 ;
		proxy_headers_hash_bucket_size 6400 ;
	}
	location /update/sso{
		alias /tianjun/files/sso;
		autoindex on;
	}
	location / {
		rewrite (.*) http://www.odboy.cn/tian-sso-web-main permanent;
	}
}

以下为静态文件配置说明

# 这里是访问的路径,即:http://{server_name}/update/sso
location /update/sso{
	# 关联的本地目录
	alias /tianjun/files/sso;
	# 是否自动生成目录树(自动索引)
	autoindex on;
}

你可能感兴趣的:(总结经验)