Skip to content

Instantly share code, notes, and snippets.

@wokamoto
Last active December 13, 2015 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wokamoto/4983999 to your computer and use it in GitHub Desktop.
Save wokamoto/4983999 to your computer and use it in GitHub Desktop.
[Nginx] Nginx で Cake PHP を動作させる
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;
}
}
@wokamoto
Copy link
Author

さらに以下のシンボリックリンクを作っておくこと

$ ln -s app/webroot/css css
$ ln -s app/webroot/img img
$ ln -s app/webroot/js js
$ ln -s app/webroot/files files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment