1
0
mirror of https://gitee.com/coder-xiaomo/notes synced 2025-01-12 04:28:15 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
notes/docs/.vuepress/public/web-server/files/day10-conf.json

139 lines
6.5 KiB
JSON
Raw Normal View History

2021-12-06 00:23:53 +08:00
{
"_comment": "Web服务器配置文件配置后请重启服务器",
"default_comment": "Web服务器站点默认配置站点配置中未配置项将以默认配置为准",
"default": {
"comment_comment": "默认配置说明(仅做备注用,无实际作用)",
"comment": "默认配置",
"web_comment": "网站相关配置",
"web": {
"host_comment": "绑定的IP或域名字符串或数组",
"host": "127.0.0.1",
"port_comment": "绑定的端口号(数字或数组)",
"port": 80
},
"path_comment": "网站目录相关配置",
"path": {
"websitePath_comment": "网站目录(绝对路径,以 '/' 结尾)",
"websitePath": "/www/wwwroot/",
"runPath_comment": "网站运行目录(相对路径,相对网站目录,以 '/' 结尾)",
"runPath": "./",
"accessLogPath_comment": "访问日志目录",
"accessLogPath": "/www/wwwlogs/",
"errorLogPath_comment": "错误日志目录",
"errorLogPath": "/www/wwwlogs/"
},
"page_comment": "默认文档相关配置",
"page": {
"defaultPage_comment": "默认文档(数组)",
"defaultPage": [
"index.html",
"index.htm",
"default.html",
"default.htm"
],
"errorPage_comment": "默认错误页(键值对)",
"errorPage": {
"403": "./403.html",
"404": "./404.html",
"500": "./500.html",
"default": "./error.html"
}
},
"ssl_comment": "SSL证书公钥、私钥配置",
"ssl": {
"private_comment": "私钥所在目录",
"private": "./private.pem",
"public_comment": "公钥所在目录",
"public": "./public.pem"
},
"reverseProxy_comment": "反向代理",
"reverseProxy": {
"state_comment": "'on' / 1 / true 表示开启,'off' / 0 / false 表示关闭",
"state": "off",
"origin_comment": "代理源配置 [Todo] 待完善",
"origin": {
"host_comment": "被代理主机(字符串)",
"host": "127.0.0.1",
"port_comment": "被代理端口号(数字)",
"port": 8080
}
},
"logs": {
"format_comment": "日志记录默认格式,需以'\r\n'结尾。设计时参考Nginx [Todo] 待完善",
"format_comment_options": {
"_": "格式(以下是可选参数)",
"{remoteAddr}": "发起请求的客户端所在IP地址",
"{remoteUser}": "发起请求的客户端用户名称,获取不到则显示为'-'",
"{timeLocal}": "用来记录访问时间与时区(依赖服务器本地时间),形如'20/Aug/2017:21:15:19 +0800',获取不到则显示为'-'",
"{request}": "记录发起的请求,形如'POST /index.html?page=1 HTTP/1.1'",
"{status}": "记录响应状态,比如'200'",
"{requestTime}": "记录请求处理时间(以秒为单位、精确到毫秒)。从读取客户端第一个字节开始算起,到发送最后一个字节给客户端的时间间隔",
"{upstreamResponseTime}": "记录Web服务器从后端服务获取响应的时间以秒为单位、精确到毫秒多个请求的时间以逗号分隔",
"{requestLength}": "记录请求长度(包括请求行,请求头,请求体)",
"{gzipRatio}": "记录nginx gzip压缩比例获取不到则显示为'-'",
"{bytesSent}": "发送给客户端的字节数",
"{bodyBytesSent}": "发送给客户端的响应体字节数",
"{connectionRequests}": "单个连接的并发请求数",
"{httpReferer}": "记录请求引用页面地址",
"{httpUserAgent}": "记录用户代理信息(通常是浏览器信息)",
"{httpXForwardedFor}": "当为了承受更大的负载使用反向代理时web服务器不能获取真实的客户端IP$remote_addr获取到的是反向代理服务器的ip这种情况下代理服务器通常会增加一个叫做x_forwarded_for的信息头把连接它的真实客户端IP加到这个信息头里这样就能保证网站的web服务器能获取到真实IP获取不到则显示为'-'",
"{connection}": "连接序列号",
"{msec}": "写入日志的时间(以秒为单位、精确到毫秒)",
"{pipe}": "如果为管道请求则显示为p否则显示为'.'"
},
"format": "{timeLocal}\t{remoteAddr}\t{status}\t{request}\t{httpUserAgent}\r\n"
}
},
"server_comment": "Web服务器服务的站点每一个站点都作为server数组的一个元素",
"server": [
{
"comment": "网站首页",
"web": {
"host": "www.only4.work",
"port": [
80,
443
]
},
"ssl": {
"private": "./ssl/private.pem",
"public": "./ssl/public.pem"
},
"path": {
"path": "/www/wwwroot/www.only4.work",
"runPath": "./public/"
},
"page": {
"defaultPage": [
"index.php",
"index.html",
"index.htm",
"default.html",
"default.htm"
],
"errorPage_comment": "默认错误页(键值对)",
"errorPage": {
"403": "./error.html?code=403",
"404": "./error.html?code=404",
"500": "./error.html?code=500",
"default": "./error.html?code=unknown"
}
}
},
{
"comment": "网站首页(代理页面)",
"web": {
"host": "www.only4.work",
"port": 888
},
"reverseProxy": {
"state": true,
"origin": {
"host": "127.0.0.1",
"port_comment": "被代理端口号",
"port": 80
}
}
}
]
}