博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
nginx静态文件访问
阅读量:7222 次
发布时间:2019-06-29

本文共 798 字,大约阅读时间需要 2 分钟。

新建staticServer.conf(先配置二级解析域名)

#staticserver{    listen 80;    server_name static.maoriaty.top;    expires 300d;    gzip on;    location / {        root  /app/deploy/static;        index index.html index.htm;    }    rewrite ^/upload/(.*)$ /upload/$1 last;    rewrite ^/(.*)/(\d+)/(.*)$ /$1/$3 last; #重写url去除缓存时间戳}#imageserver{    listen 80;    server_name img.maoriaty.top;    expires 300d;    gzip on;    location / {        root  /app/deploy/static;        index index.html index.htm;    }}#fileserver{    listen 80;    server_name file.maoriaty.top;    expires 300d;    gzip on;    location / {        root  /app/deploy/static;        index index.html index.htm;    }}

修改nginx.conf

include staticServer.conf; #在http里最后添加

 重启

nginx -s reload

查看

 

转载于:https://www.cnblogs.com/maoriaty/p/8232827.html

你可能感兴趣的文章
【玩转Ubuntu】01. Ubuntu上配置JDK
查看>>
Leetcode: Path Sum
查看>>
我为什么放弃Go语言
查看>>
pthread_rwlock
查看>>
WEB打印(jsp版)
查看>>
URLEncode与URLDecode总结与实现
查看>>
Gradle 多渠道打包的使用和错误分析(转)
查看>>
压力测试衡量CPU的三个指标:CPU Utilization、Load Average和Context Switch Rate
查看>>
C/C++程序员必须熟练应用的开源项目
查看>>
win32下编译glog
查看>>
C#编程(五十二)----------有序列表
查看>>
攻防工具
查看>>
获取包下的类名
查看>>
Fluent UDF【7】:解释型UDF
查看>>
cocos2dX 之数据存储
查看>>
Android应用程序安装过程浅析
查看>>
浅谈浏览器兼容解决方案
查看>>
react-native 项目实战 -- 新闻客户端(1) -- 初始化项目结构
查看>>
ToggleButton开关状态按钮控件
查看>>
kafka单机模式部署安装,zookeeper启动
查看>>