以www.ff.com为例,访问后台的路径则为www.ff.com/admin
server {
listen 80;server_name www.ff.com;
set $root /home/wwwroot/ff;
root $root;
index index.php;
access_log /home/wwwroot/ff/logs/access.log;
error_log /home/wwwroot/ff/logs/error.log;
location / {
root /home/wwwroot/ff/frontend/web;
try_files $uri /frontend/web/index.php?$args;
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
access_log off;
expires 360d;
try_files $uri =404;
}
}
location /admin {
alias /home/wwwroot/ff/backend/web;
rewrite ^(/admin)/$ $1 permanent;
try_files $uri /back