server { | |
listen 80 default; | |
server_name example.com; | |
root /path/to/cake_php; | |
index index.php index.html index.htm; | |
charset utf-8; | |
access_log /var/log/nginx/access.log main; | |
error_log /var/log/nginx/error.log; | |
location ~* \.(js|css|html?|xml|gz|jpe?g|gif|png|swf|wmv|flv|ico)$ { | |
expires 7d; | |
} | |
location / { | |
try_files $uri $uri/ /index.php?url=$uri$args; | |
} | |
location ~ \.php$ { | |
try_files $uri =404; | |
expires off; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass phpfpm; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} |
さらに /path/to/cake_php に移動して、以下のシンボリックリンクを作っておくこと
$ ln -s app/webroot/css css
$ ln -s app/webroot/img img
$ ln -s app/webroot/js js
$ ln -s app/webroot/files files