一、配置

#vi /usr/local/nginx/conf/vhost/test.com.conf

写入;

server

{

listen 80;

server_name test.com test1.com test2.com;

index index.html index.htm index.php;

root /data/nginx/test.com;

if ($host != 'test.com' ){

rewrite ^(.*)$ http://test.com/$1 permanent;

}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

{

expires 7d;

access_log off;

}

location ~ .*\.(js|css)$

{

expires 12h;

}

access_log /tmp/1.log combined_realip;

}

#/usr/local/nginx/sbin/nginx -t

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

#echo "11111" > /data/nginx/test.com/1.js

//创建js文件

#echo "22222" > /data/nginx/test.com/2.jpg

//创建jpg文件

#touch /data/nginx/test.com/1.jss

//创建一个对比的文件

2.5.2检验测试

#curl -I -x127.0.0.1:80 test.com/1.js

状态码200

#curl -I -x127.0.0.1:80 test.com/2.jpg

状态码200

#curl -I -x127.0.0.1:80 test.com/1.jss

状态码200

#cat /tmp/1.log

查看日志

显示以上图片显示成功

LNMP配置——Nginx配置 —— 配置静态文件不记录日志并添加过期时间的更多相关文章

  1. Nginx访问日志 Nginx日志切割 静态文件不记录日志和过期时间

  2. Nginx访问日志、日志切割、静态文件不记录日志和过期时间

    6月8日任务 12.10 Nginx访问日志12.11 Nginx日志切割12.12 静态文件不记录日志和过期时间 12.10 Nginx访问日志 除了在主配置文件nginx.conf里定义日志格式外 ...

  3. nginx日志、nginx日志切割、静态文件不记录日志和过期时间

    2019独角兽企业重金招聘Python工程师标准>>> 12.10 Nginx访问日志 日志格式 vim /usr/local/nginx/conf/nginx.conf //搜索l ...

  4. React BrowserHistory 踩坑实录 布置到服务器Nginx上各种静态文件、二级地址404

    由于BrowserHistory访问的是文件真实地址不仅需要前端配置package.json还需要运维端配置一下网站Nginx设置环境: "react": "^17.0. ...

  5. Nginx访问日志、 Nginx日志切割、静态文件不记录日志和过期时间

    1.Nginx访问日志 配制访问日志:默认定义格式: log_format combined_realip '$remote_addr $http_x_forwarded_for [$time_loc ...

  6. Linux centosVMware Nginx访问日志、Nginx日志切割、静态文件不记录日志和过期时间

    一.Nginx访问日志 vim /usr/local/nginx/conf/nginx.conf //搜索log_format  日至格式 改为davery格式 $remote_addr  客户端IP ...

  7. 使用nginx部署Django静态文件配置

    首先,我们配置静态文件,要在setting.py里面加入如下几行代码: # settings.py # the settings above # STATIC SETTINGS STATIC_URL ...

  8. nginx安装,配置,并可以放静态文件教程

    简单介绍一下:nginx是一个高性能的HTTP和反向代理的服务器.能有处理最高5,0000的并发量,是新兴的一个代理服务器.中国大陆使用nginx网站用户有:百度.京东.新浪.网易.腾讯.淘宝等. 安 ...

  9. VMware Linux 下 Nginx 安装配置 - nginx.conf 配置 [负载两个 Tomcat] (三)

    首先启动Nginx 1. 相关浏览 两个 Tomcat 配置:  VMware Linux 下 Nginx 安装配置 - Tomcat 配置 (二) Nginx 安装配置启动: VMware Linu ...

随机推荐

  1. 导出Excel的异常处理

    问题: 提示:"类 Range 的 Select 方法无效" 处理方法: 设置当前工作表 this.worksheet.Activate();

  2. Node.js 返回 JSON 数据

    Node.js 返回 JSON 数据 request.end([data[, encoding]][, callback]) var http = require('http'); const log ...

  3. set CSS style in js solutions All In One

    set CSS style in js solutions All In One css in js set each style property separately See the Pen se ...

  4. Immutable.js 实现原理

    Immutable.js 实现原理 Immutable collections for JavaScript v4.0.0-rc.12 released on Oct 31, 2018 https:/ ...

  5. swiper & swiper slider

    swiper & swiper slider mobile swiper https://idangero.us/swiper/ https://idangero.us/swiper/get- ...

  6. module patterns

    module patterns ebooks https://github.com/xyzata/2017-new-ebooks/blob/master/Succinctly/modulepatter ...

  7. git config [section] solutions

    git config [section] solutions fix git [section] warnings global config $ vim ~/.gitconfig [user] em ...

  8. Docker In Action

    Docker In Action Docker 实战 https://docs.docker.com/get-started/overview/ Docker Engine Docker Archit ...

  9. taro scroll tabs 滚动标签 切换

    taro scroll tabs 滚动标签 切换 https://www.cnblogs.com/lml-lml/p/10954069.html https://developers.weixin.q ...

  10. opencv打不开摄像头

    问题描述: capFace = cv2.VideoCapture(0) 报错: VIDEOIO ERROR: V4L2: Unable to capture video memory. VIDEOIO ...