随笔分类 -  nginx

摘要: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 起点·漫步前行 阅读(103) 评论(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 起点·漫步前行 阅读(33) 评论(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 起点·漫步前行 阅读(115) 评论(0) 推荐(0)
摘要:未完成 ngx_http_rewrite_module rewrite regex replacement [flag] 将用户请求的URI基于regex所描述的模式进行检查,匹配到时将其替换为replacement指定的新的URI 注意:如果在同一级配置块中存在多个rewrite规则,那么会自下而 阅读全文
posted @ 2024-08-29 09:10 起点·漫步前行 阅读(34) 评论(0) 推荐(0)
摘要:ngx_http_rewrite_module 将用户请求的URI基于PCRE regex所描述的模式进行检查,而后完成重定向替换 if:Syntax: if (condition) { ... } Default: — Context: server, location 条件满足时,执行配置块中的 阅读全文
posted @ 2024-08-29 09:09 起点·漫步前行 阅读(172) 评论(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 起点·漫步前行 阅读(437) 评论(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 起点·漫步前行 阅读(55) 评论(0) 推荐(0)
摘要:favicon.ico 文件是浏览器收藏网址时显示的图标,当使用浏览器访问页面时,浏览器会自己主动发起请求获取页面的favicon.ico文件,但是当浏览器请求的favicon.ico文件不存在时,服务器会记录404日志,而且浏览器也会显示404报错(F12查看浏览器请求情况) 解决方案: 1、不加 阅读全文
posted @ 2024-08-29 09:07 起点·漫步前行 阅读(592) 评论(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 起点·漫步前行 阅读(207) 评论(0) 推荐(0)
摘要:第三方模块:echo 第三模块是对nginx 的功能扩展,第三方模块需要在编译安装nginx 的时候使用参数--add-module=PATH指定路径添加,有的模块是由公司的开发人员针对业务需求定制开发的,有的模块是开源爱好者开发好之后上传到github进行开源的模块,nginx支持第三方模块,需要 阅读全文
posted @ 2024-08-29 09:04 起点·漫步前行 阅读(267) 评论(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 起点·漫步前行 阅读(36) 评论(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 起点·漫步前行 阅读(35) 评论(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 起点·漫步前行 阅读(29) 评论(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 起点·漫步前行 阅读(66) 评论(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 起点·漫步前行 阅读(70) 评论(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 起点·漫步前行 阅读(71) 评论(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 起点·漫步前行 阅读(155) 评论(0) 推荐(0)