nginx rewrite正则匹配()匹配子组最多匹配到$9,就是从$0到$9 当需要匹配更多子组时,可通过变量来实现 if ($uri ~ ^/forum-15/sortid-74/(.*?)(lastpost|dateline)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$){ set $orderby $2; set $mdate $3; set $workhours $4; set $pricerange $5; se
基本配置 为了探究nginx的url配置规则,当然需要安装nginx.我使用了vagrant创建了一个虚拟环境的ubuntu,通过apt-get安装nginx.这样就不会污染mac的软件环境.通过vragrant再创建一个项目进行实验.如果不了解vagrant的使用,可以查看Vagrant 虚拟环境利器. /vagrant目录下创建了一个pro用于项目的根目录,同时配置nginx的配置文件(/etc/nginx/sites-enabled/pro.conf) ☁ pro tree . ├── 4
这作为一个备份,方便查询,毕竟nginx的强大,必然有其复杂性! Location modifier Nginx allows you to define location blocks by specifying a pattern that will be matched against the requested document URI. server { server_name website.com; location /admin/ { # The configuration yo