上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 42 下一页
摘要: 1.root配置 [root@web01 /etc/nginx/conf.d]# vim root.conf server { listen 80; server_name linux.root.com; location /download { root /code; } } #使用root时,当 阅读全文
posted @ 2020-09-11 16:01 六月OvO 阅读(128) 评论(0) 推荐(0)
摘要: 一台服务器配置多个网站,如果配置都写在nginx.conf主配置文件中,会导致nginx.conf主配置文件变得非常庞大而且可读性非常的差。那么后期的维护就变得麻烦。 假设现在希望快速的关闭一个站点,该怎么办? 1.如果是写在nginx.conf中,则需要手动注释,比较麻烦 2.如果是include 阅读全文
posted @ 2020-09-11 15:57 六月OvO 阅读(588) 评论(0) 推荐(0)
摘要: 1.禁止IP访问直接返回错误 [root@web01 /etc/nginx/conf.d]# vim a_ip.conf server { listen 80 default_server; server_name localhost; return 500; } 2.引流的方式跳转页面 [root 阅读全文
posted @ 2020-09-11 15:56 六月OvO 阅读(274) 评论(0) 推荐(0)
摘要: [root@nginx ~]# cat nginx.conf user www; worker_processes auto; worker_cpu_affinity auto; error_log /var/log/nginx/error.log warn; pid /run/nginx.pid; 阅读全文
posted @ 2020-09-11 15:50 六月OvO 阅读(166) 评论(0) 推荐(0)
摘要: #盗链就是由我的网站向你的网站发起get获取资源的请求 #跨域访问由我的网站向你的网站发起http的链接请求 1)配置被跨域的网站 [root@web02 /etc/nginx/conf.d]# vim beikuayu.conf server { listen 80; server_name li 阅读全文
posted @ 2020-09-11 15:49 六月OvO 阅读(522) 评论(0) 推荐(0)
摘要: 1)配置被盗链的网站 [root@web02 /etc/nginx/conf.d]# vim beidaolian.conf server { listen 80; server_name linux.beidaolian.com; location / { root /code/beidaolia 阅读全文
posted @ 2020-09-11 15:46 六月OvO 阅读(109) 评论(0) 推荐(0)
摘要: 1)静态资源压缩语法 #开启压缩 Syntax: gzip on | off; Default: gzip off; Context: http, server, location, if in location #指定压缩类型 Syntax: gzip_types mime-type ...; D 阅读全文
posted @ 2020-09-11 15:33 六月OvO 阅读(119) 评论(0) 推荐(0)
摘要: #公司测试化境经常更新前端代码,需要关闭缓存 1.使用无痕模式 2.开启浏览器 Disable cache 3.配置nginx location ~* \.(jpg|png|gif)$ { root /code/cache; add_header Cache-Control no-cache; et 阅读全文
posted @ 2020-09-11 15:30 六月OvO 阅读(141) 评论(0) 推荐(0)
摘要: #语法 Syntax: expires [modified] time; expires epoch | max | off; Default: expires off; Context: http, server, location, if in location #配置过期时间 [root@we 阅读全文
posted @ 2020-09-11 15:29 六月OvO 阅读(255) 评论(0) 推荐(0)
摘要: 1.浏览器会先去查看响应头部的cache-control(缓存控制)2.如果没有到达过期时间,会直接返回缓存中的内容,不需要重新读取服务器3.如果cache-control设置为 no-cache,浏览器会去读取expires(缓存过期时间)4.如果没有到达expires过期时间,会直接返回缓存中的 阅读全文
posted @ 2020-09-11 15:27 六月OvO 阅读(600) 评论(0) 推荐(0)
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 42 下一页