摘要: nginx之错误url重定向到首页 1、配置: [root@centos7.6 ~]# vi test.conf server { listen 443 ssl; listen 80; server_name www.magedu.org; root /data/site14/; #ssl on; 阅读全文
posted @ 2024-08-29 09:12 起点·漫步前行 阅读(84) 评论(0) 推荐(0)
摘要: nginx支持一台服务器唯一IP:PORT,根据server_name创建区分多个经过ssl加密的https虚拟主机,apache不支持 生成www.magedu.net域名证书: [root@centos7.6 logs]# cd /etc/pki/tls/certs/ [root@centos7 阅读全文
posted @ 2024-08-29 09:11 起点·漫步前行 阅读(17) 评论(0) 推荐(0)
摘要: http跳转https实现示例: ssl配置参考“https”实现文章 法一:2个虚拟主机 配置: [root@centos7.6 certs]# vim /apps/nginx4/conf/conf.d/test.conf server { listen 443 ssl; # listen 80; 阅读全文
posted @ 2024-08-29 09:11 起点·漫步前行 阅读(94) 评论(0) 推荐(0)
摘要: 未完成 ngx_http_rewrite_module rewrite regex replacement [flag] 将用户请求的URI基于regex所描述的模式进行检查,匹配到时将其替换为replacement指定的新的URI 注意:如果在同一级配置块中存在多个rewrite规则,那么会自下而 阅读全文
posted @ 2024-08-29 09:10 起点·漫步前行 阅读(19) 评论(0) 推荐(0)
摘要: ngx_http_rewrite_module 将用户请求的URI基于PCRE regex所描述的模式进行检查,而后完成重定向替换 if:Syntax: if (condition) { ... } Default: — Context: server, location 条件满足时,执行配置块中的 阅读全文
posted @ 2024-08-29 09:09 起点·漫步前行 阅读(127) 评论(0) 推荐(0)
摘要: ngx_http_ssl_module ngx_http_ssl_module模块: ssl on | off; 为指定虚拟机启用HTTPS protocol, 建议用listen指令代替 ssl_certificate file; 当前虚拟主机使用PEM格式的证书文件 ssl_certificat 阅读全文
posted @ 2024-08-29 09:09 起点·漫步前行 阅读(365) 评论(0) 推荐(0)
摘要: ngx_http_gzip_module ngx_http_gzip_module 用gzip方法压缩响应数据,节约带宽 gzip on | off; 启用或禁用gzip压缩 Default: gzip off; Context: http, server, location, if in loca 阅读全文
posted @ 2024-08-29 09:08 起点·漫步前行 阅读(33) 评论(0) 推荐(0)
摘要: favicon.ico 文件是浏览器收藏网址时显示的图标,当使用浏览器访问页面时,浏览器会自己主动发起请求获取页面的favicon.ico文件,但是当浏览器请求的favicon.ico文件不存在时,服务器会记录404日志,而且浏览器也会显示404报错(F12查看浏览器请求情况) 解决方案: 1、不加 阅读全文
posted @ 2024-08-29 09:07 起点·漫步前行 阅读(496) 评论(0) 推荐(0)
摘要: ngx_http_log_module ngx_http_log_module模块 指定日志格式记录请求 log_format name string ...; string可以使用nginx核心模块及其它模块内嵌的变量 Default: log_format combined "..."; Con 阅读全文
posted @ 2024-08-29 09:05 起点·漫步前行 阅读(192) 评论(0) 推荐(0)
摘要: 第三方模块:echo 第三模块是对nginx 的功能扩展,第三方模块需要在编译安装nginx 的时候使用参数--add-module=PATH指定路径添加,有的模块是由公司的开发人员针对业务需求定制开发的,有的模块是开源爱好者开发好之后上传到github进行开源的模块,nginx支持第三方模块,需要 阅读全文
posted @ 2024-08-29 09:04 起点·漫步前行 阅读(234) 评论(0) 推荐(0)
摘要: 输出nginx的基本状态信息 模块:ngx_http_stub_status_module 输出信息示例:Active connections: 291 server accepts handled requests #下面三个数分别对应accepts,handled,requests 166309 阅读全文
posted @ 2024-08-29 09:04 起点·漫步前行 阅读(42) 评论(0) 推荐(0)
摘要: 配置nginx文件下载服务 模块:ngx_http_autoindex_module 常用指令: autoindex on | off; 自动文件索引功能,默为off Default: autoindex off; Context: http, server, location autoindex_ 阅读全文
posted @ 2024-08-29 09:03 起点·漫步前行 阅读(15) 评论(0) 推荐(0)
摘要: ngx_http_auth_basic_module模块 实现基于用户的访问控制,使用basic机制进行用户认证 auth_basic string | off; auth_basic_user_file file; Default: — Context: http, server, locatio 阅读全文
posted @ 2024-08-29 09:03 起点·漫步前行 阅读(21) 评论(0) 推荐(0)
摘要: ngx_http_access_module模块 可实现基于ip的访问控制功能 allow address | CIDR | unix: | all; deny address | CIDR | unix: | all; Default: — Context: http, server, locat 阅读全文
posted @ 2024-08-29 09:02 起点·漫步前行 阅读(12) 评论(0) 推荐(0)
摘要: 1、aio on | off | threads[=pool]; 是否启用aio功能,默认off2、directio size | off; 当文件大于等于给定大小时,同步(直接)写磁盘,而非写缓存,默认off 示例: location /video/ { sendfile on; aio on; 阅读全文
posted @ 2024-08-29 09:01 起点·漫步前行 阅读(44) 评论(0) 推荐(0)
摘要: 1、limit_rate rate; 限制响应给客户端的传输速率,单位是bytes/second 默认值0表示无限制 Default: limit_rate 0; Context: http, server, location, if in location [root@centos7.6 ~]# 阅读全文
posted @ 2024-08-29 09:01 起点·漫步前行 阅读(47) 评论(0) 推荐(0)
摘要: 1、keepalive_timeout: 长连接超时时间 Default: keepalive_timeout 75s; Context: http, server, location 示例:在响应头显示此首部字段 keepalive_timeout 60 60; 示例: [root@centos7 阅读全文
posted @ 2024-08-29 09:00 起点·漫步前行 阅读(33) 评论(0) 推荐(0)
摘要: 一、keepalived概述 官方网站:https://www.keepalived.org/ keepalived: vrrp协议:virtual router redundancy protocol vrrp是一种容错协议,它保证当lvs调度器MASTER出现故障时,由另一台lvs调度器BACK 阅读全文
posted @ 2024-08-29 08:50 起点·漫步前行 阅读(62) 评论(0) 推荐(0)
摘要: 一、I/O模型 二、nginx概述 官网:http://nginx.org 2.1 、nginx介绍 nginx: engine X,是由1994年毕业于俄罗斯国立莫斯科鲍曼科技大学的同学为俄罗斯rambler.ru公司开发的, 开发工作最早从2002年开始,第一次公开发布时间是2004年10月4日 阅读全文
posted @ 2024-08-29 08:49 起点·漫步前行 阅读(120) 评论(0) 推荐(0)
摘要: keepalived实现lvs高可用 说明:lvs单实例 拓扑: 环境说明: 1、client网关指向Router,跨网段访问lvs-VIP,需要指定正确网关和路由,如果client和Route之间还有其他路由或防火墙设备,网关设置直连路由IP 2、虚拟机模拟路由器,Router需要开启路由转发ip 阅读全文
posted @ 2024-08-29 08:49 起点·漫步前行 阅读(138) 评论(0) 推荐(0)