1
我嘗試使用Nginx設置子域,但出現一些錯誤。下面是我的配置:如何設置Nginx配置來重新生成我的子域
server {
listen 80;
server_name dimain.com *.domain.com;
root /path/to/fuelphp_project/public;
location/{
index index.php index.html index.htm;
if ($host ~ (.*)\.(.*)) {
set $sub_name $1;
rewrite ^/(.*)$ /index.php/$sub_name/$1 last;
break;
}
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
break;
}
}
...
}
我想要的結果,如:
sub1.domain.com/c1/a1 -> domain.com/sub1/c1/a1
sub2.domain.com/c2/a2 -> domain.com/sub2/c2/a2
請幫助我如何糾正它。非常感謝!
您需要在更改.conf後重新啓動nginx。 – Gabriel
它的工作原理!非常感謝你! – LanceHe
您的歡迎LanceHe – Gabriel