使用slim framework時 對於nginx的配置設定 2018-02-18
適用我的linode主機
nginx版本 1.10.1
[code]
location ^~ /orion.kahza/ {
alias /var/www/html/www-pure/;
index index.php;
try_files $uri $uri/ @front;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
}
location @front {
rewrite /(.*)$ /orion.kahza/index.php?/$1 last;
}
[/code]
location ^~ /orion.kahza/ → url路徑
alias /var/www/html/www-pure/; → 內部路徑
rewrite /(.*)$ /orion.kahza/index.php?/$1 last; → 隱藏index.php外, 當外部url路徑非index.php 將透過此行改寫