Nginx配置静态资源访问

server {
listen 8079;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root html;//所有资源的根目录
index index.html index.htm;
}

location ~ .*\.(gif|jpg|jpeg|png)$ {
root html/files; //附件资源目录,注意如果html前面多个斜杠就是绝对路径,和硬盘路径有关
proxy_store on;
proxy_store_access user:rw group:rw all:rw;
proxy_temp_path html/files;#图片访问路径
proxy_redirect off;
proxy_set_header Host 127.0.0.1;
client_max_body_size 10m;
client_body_buffer_size 1280k;
proxy_connect_timeout 900;
proxy_send_timeout 900;
proxy_read_timeout 900;
proxy_buffer_size 40k;
proxy_buffers 40 320k;
proxy_busy_buffers_size 640k;
proxy_temp_file_write_size 640k;
if ( !-e $request_filename)
{
proxy_pass http://127.0.0.1;#默认80端口
}
}

}

原文链接:https://blog.csdn.net/zhang8907xiaoyue/article/details/86911537?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165277103516781435456458%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=165277103516781435456458&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-23-86911537-null-null.nonecase&utm_term=%E8%B5%84%E6%BA%90

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发
头像
文明发言,共建和谐米科社区
提交
头像

昵称

取消
昵称表情图片