Buat yang pake CakePHP tapi webserver-nya Nginx (with PHP-FPM). Berikut contoh konfigurasi Nginx yang saya pakai.
(Catatan : PHP-FPM nya jalan di Unix socket ya.., bukan di Port 9000. Kalau PHP-FPM anda jalan di Port 9000, sesuaikan saja).
server {
listen 80;
server_name www.websitemu.com;
root /var/www/app/webroot;
client_max_body_size 10m;
access_log /var/log/nginx/access.log;
location / {
root /var/www/app/webroot;
index index.php index.html index.htm;
#baris dibawah ini sebagai pengganti .htaccess untuk CakePHP
if (!-e $request_filename) {
rewrite ^/(.+)$ /index.php?url=$1 last;
break;
}
}
# baris - baris berikut ini untuk Cache, harusnya ada yang lebih simpel
# (bisa dijadikan satu paramater), tapi yang saya coba
# gagal melulu, jadi demi mengejar waktu live, ini dulu yang dipakai
location ~* \favicon.ico$ {
access_log off;
expires 30d;
add_header Cache-Control public;
}
location ~ \.css$ {
access_log off;
expires 30d;
add_header Cache-Control public;
}
location ~ \.js$ {
access_log off;
expires 30d;
add_header Cache-Control public;
}
# baris berikut untuk setting PHP-FPM nya.
location ~ \.php$ {
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
salam kenal bRo, saya lagi testing phpmotion di nginx, u/ setup nya berhasil tinggal di htaccess nya nih bersalamah hehehe. untuk location ~ /\.ht fungsinya apa yah.?
saya bingung di konfigurasi
order allow,deny
allow from all
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteRule \.(css|jpe?g|gif|png|flv|swf)$ – last;
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/members/(.?)$ /people [R=301]
RewriteCond %{QUERY_STRING} (\<||>) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteCond %{QUERY_STRING} SELECT(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} UNION(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteRule ^(.*)$ index.php [F,L]
Options -Indexes
SecFilterEngine Off
SecFilterScanPOST Off
ErrorDocument 403 /403.php
ErrorDocument 404 /404.php
Cara nerjemahin ke nginx nya gmn.?
mohon pencerahan nya..