问题描述
server {listen 80;server_name localhost; index index.html index.htm index.php; root /alidata; location ~ .*.(php|php5)?$ {#fastcgi_pass unix:/tmp/php-cgi.sock;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;include fastcgi.conf; } location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ {expires 30d; } location ~ .*.(js|css)?$ {expires 1h; } location / { if (!-e $request_filename) { rewrite (.*) /index.php; } }}
我现在是root /alidata;即指向alidata下的根目录。
如果只指向两个/alidata/A,/alidata/B,如何设置?
问题解答
回答1:你可以给每个location添加正则来匹配A和B,比如 location/(A|B)/代替~