一、配置

#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. 修改jpg的图片大小

    using System.Drawing.Imaging; public void ResizePic(string oldFilePath, int thumbnailImageWidth, int ...

  2. HDU 3949 XOR (线性基第k小)题解

    题意: 给出\(n\)个数,求出子集异或第\(k\)小的值,不存在输出-1. 思路: 先用线性基存所有的子集,然后对线性基每一位进行消元,保证只有\(d[i]\)的\(i\)位存在1,那么这样变成了一 ...

  3. 计量经济学导论10:ARIMA模型

    目录 ${\rm ARIMA}$ 模型 滞后算子 ${\rm MA}(q)$ 模型 ${\rm MA}(1)$ 模型 ${\rm MA}(q)$ 模型 ${\rm AR}(p)$ 模型 ${\rm A ...

  4. 012.NET5_MVC_Razor布局

    Razor 页面组成到底有哪些内容? 包含了Layout的母版嵌套的返回需要渲染的视图内容: 如何嵌套? 通过Layout中的RenderBody()方法做了替换,把返回的视图替换到母版页中,形成了一 ...

  5. CSS clip-path in action

    CSS clip-path in action <!DOCTYPE html> <html lang="en"> <head> <meta ...

  6. Right in the Center (js string algorithm)

    Right in the Center (js string algorithm) codewars https://www.codewars.com/kata/5f5da7a415fbdc0001a ...

  7. Python Quiz & Python Exercise

    Python Quiz & Python Exercise https://www.w3schools.com/quiztest/quiztest.asp?qtest=PYTHON https ...

  8. js & regex & var & highlight

    js & regex & var & highlight let key = `ali`.toLocaleUpperCase(); let name = "阿里云计算 ...

  9. D language

    D language https://en.wikipedia.org/wiki/D_(programming_language) Dart https://dlang.org/ flutter fr ...

  10. 智能合约稳定币USDN的价值在哪里?

    近几年来,区块链和数字货币市场快速发展,客观上需要价格相对稳定的交易媒介和贮藏手段,从而推动以链上资产或链下资产抵押型稳定币和算法型稳定币出现,以实现币价相对稳定的数字货币.市场上开始出现了诸如USD ...