一、配置

#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. codeforces 1076E Vasya and a Tree 【dfs+树状数组】

    题目:戳这里 题意:给定有n个点的一棵树,顶点1为根.m次操作,每次都把以v为根,深度dep以内的子树中所有的顶点(包括v本身)加x.求出最后每个点的值为多少. 解题思路:考虑到每次都只对点及其子树操 ...

  2. codeforces 876B

    B. Divisiblity of Differences time limit per test 1 second memory limit per test 512 megabytes input ...

  3. HDU 5608 function(莫比乌斯反演 + 杜教筛)题解

    题意: 已知\(N^2-3N+2=\sum_{d|N}f(d)\),求\(\sum_{i=1}^nf(i) \mod 1e9+7\),\(n\leq1e9\) 思路: 杜教筛基础题? 很显然这里已经设 ...

  4. Dell Display Manager for Mac

    Dell Display Manager for Mac DDM for macOS solution https://www.dell.com/community/Monitors/DDM-for- ...

  5. npm publish bug & solution

    npm publish bug & solution npm ERR! Unexpected token < in JSON at position 0 while parsing ne ...

  6. 蓝湖 UI 设计稿上如何生成渐变色和复制渐变色

    蓝湖 UI 设计稿上如何生成渐变色和复制渐变色 Sketch 生成渐变色 不要上传图片,切图 如果是切图,切图模式下就不会生成 css 代码了 复制渐变色 OK .button { width: 28 ...

  7. we have a problem with promise

    we have a problem with promise Q: What is the difference between these four promises? doSomething() ...

  8. 使用 js 实现一个简易版的模版引擎

    使用 js 实现一个简易版的模版引擎 regex (function test() { this.str = str; })( window.Test = ...; format() { let ar ...

  9. Windows 常用键盘快捷键:

    键盘快捷键 通过使用键盘快捷键可以节省时间. Windows 和 Mac 的键盘快捷键 在现代操作系统中和计算机软件程序中,键盘快捷键经常被使用. 使用键盘快捷键能帮您节省很多时间. 基本的快捷键 描 ...

  10. js console.log color all in one

    js console.log color all in one console.log color Chrome console.log 语法 / grammar %c, %s, css style ...