蒼天家 本家
Nginx 使用php framework 多專案方式處理 2016-12-10
server {
listen 80;
server_name localhost;
access_log logs/access.log;
error_log logs/error.log;

index index.php index.html;

# == 非framework專案 ==
location / {

root d:/www;

location ~ \.php$ {
fastcgi_pass php_processes;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
# == 非framework專案 ==

# == framework專案 ==
location ^~ /xxxx/ {

alias d:/slim/;
try_files $uri $uri/ @slim;
#try_files $uri $uri/ /xxxx/index.php$is_args$args;

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass php_processes;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
}

location @slim {
rewrite /(.*)$ /xxxx/index.php?/$1 last;
}
# == framework專案 ==
}

Ref:
https://laracasts.com/discuss/channels/laravel/nginx-setup-for-multiple-projects
https://blog.martinfjordvald.com/2011/01/no-input-file-specified-with-php-and-nginx/
http://www.wkii.org/nginx-set-directory-alias-and-root.html
關於我

隨手用部落格

紀錄平時學習用到的東西

考慮想重改版

Github 自學倉庫

我的 Github 帳號

PHP開發

公司: 原生PHP

個人: Slim -> Flight