在 Nginx 中設定子目錄內的 Slim Framework 應用網址


簡單記錄一下在 nginx 裡面,處理 Slim Framework 的 URL Rewrite 方法

2012/10/06 15:29

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
server {
listen 80;
charset utf-8;
server_name example.com www.example.com;
root /path/to/your/document_root;
index index.html index.htm index.php;

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

location /sub-directory-app {
try_files $uri $uri/ /sub-directory-app/index.php?$request_uri;
}

location ~ /\.ht {
deny all;
}
}