nginx location 配置
1. url 结构说明
https://zhangsan:123456@hostname:8888/path/path2?param=value#h123
示例部分 | 英文名 | 中文名 | 说明 |
---|---|---|---|
https: | protocol | 协议名 | http:, https: |
zhangsan | username | 用户名 | |
123456 | password | 密码 | |
hostname | hostname | 主机名 | |
hostname:8888 | host | 包含域(即主机名)、后跟 (如果指定了端口)“:”和URL的端口 |
|
8888 | port | 端口 | |
/path/path2 | pathname | 文件路径 | |
#h123 | hash | 片段标识符 | |
?param=value | search | 参数字符串 | 以开头的“?”开头 |
2. nginx server 部分简单说明
server {
# 监听的端口
listen 80;
# 监听的主机名,可以包含 “*” 进行模糊匹配,可以使用正则表达式,进行正则匹配, 空格分隔
server_name example.org www.example.org *.chengwithle.com ~^(www\.)?(?<domain>.+)$;
location / {
....
}
}
3. nginx location 部分简单说明
参考