|
540 | 540 | - [x] [nginx变量使用方法详解笔记(3)](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx/nginx-2-config.md)
|
541 | 541 | + Nginx指令执行顺序
|
542 | 542 | - [x] [Nginx指令执行命令(01)](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx-Develop/command-order-01.md)
|
543 |
| -#### <a name="Nginx_Web2_knowledge"/> 第二章 安装部署 |
| 543 | +#### <a name="Nginx_Web2_knowledge"/> 第二章 安装部署 |
| 544 | ++ 启动错误:`Nginx [emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)`,执行:`sudo fuser -k 80/tcp` |
544 | 545 | + [基于域名、IP的虚拟主机配置](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx/Nginx-Web/Nginx-2-4-all-config.md)
|
545 | 546 | + [完整、标准配置实际示列](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx/Nginx-Web/Nginx-2-4-basic-config.md)
|
546 | 547 | + [日志文件配置与切割](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx/Nginx-Web/Nginx-2-4-log-cut.md)
|
|
759 | 760 | + TCP负载均衡
|
760 | 761 | - [x] [Module ngx_stream_core_module](http://nginx.org/en/docs/stream/ngx_stream_core_module.html#stream)
|
761 | 762 | - [x] [负载均衡](https://github.com/Tinywan/Lua-Nginx-Redis/blob/master/Nginx/Nginx-Web/Nginx-8-tcp-Proxy.md)
|
| 763 | ++ proxy_pass 代理的URL总结 |
| 764 | + + 在nginx中配置proxy_pass时,当在后面的url加上了/,相当于是绝对根路径,则nginx不会把location中匹配的路径部分代理走;如果没有/,则会把匹配的路径部分也给代理走。 |
| 765 | + + 将url中以/wap/开头的请求转发到后台对应的某台server上,注意最后的?$args,表明把原始url最后的get参数也给代理到后台 |
| 766 | + ```bash |
| 767 | + location ~* /wap/(\d+)/(.+) |
| 768 | + { |
| 769 | + proxy_pass http://mx$1.test.com:6601/$2?$args; |
| 770 | + } |
| 771 | + ``` |
| 772 | + + 第一种配置,访问:`http://127.0.0.1/proxy/index.html` 会被代理到:`http://127.0.0.1:8000/index.html` |
| 773 | + ```bash |
| 774 | + location /proxy/ { |
| 775 | + proxy_pass http://127.0.0.1:8000/; |
| 776 | + } |
| 777 | + ``` |
| 778 | + + 第二种配置,访问:`http://127.0.0.1/proxy/index.html` 会被代理到:`http://127.0.0.1:8000/proxy/index.html` |
| 779 | + ```bash |
| 780 | + location /proxy/ { |
| 781 | + proxy_pass http://127.0.0.1:8000; |
| 782 | + } |
| 783 | + ``` |
| 784 | + + 第三种配置,访问:`http://127.0.0.1/proxy/index.html` 会被代理到:`http://127.0.0.1:8000/video/index.html` |
| 785 | + ```bash |
| 786 | + location /proxy/ { |
| 787 | + proxy_pass http://127.0.0.1:8000/video/; |
| 788 | + } |
| 789 | + ``` |
| 790 | + + 第四种配置,访问:`http://127.0.0.1/proxy/index.html` 会被代理到:`http://127.0.0.1:8000/videoindex.html` |
| 791 | + ```bash |
| 792 | + location /proxy/ { |
| 793 | + proxy_pass http://127.0.0.1:8000/video; |
| 794 | + } |
| 795 | + ``` |
| 796 | ++ location 直接访问: |
| 797 | + + 以下配置,当访问:`http://127.0.0.1:8000/proxy/index.html` 会被匹配到:`/usr/local/nginx/html/proxy/index.html` |
| 798 | + ```bash |
| 799 | + location /proxy/ { |
| 800 | + root /usr/local/nginx/html; |
| 801 | + index index.html index.htm; |
| 802 | + } |
| 803 | + ``` |
| 804 | + |
762 | 805 | ## <a name="Nginx_Web8_knowledge"/> 第八章 缓存机制
|
763 | 806 | + 测试一
|
764 | 807 | ## <a name="Nginx_Web9_knowledge"/> 第九章 Nginx初探1
|
|
0 commit comments