CI一直是小專案好用的PHP Framework
今年初公司將伺服器從Apache幾乎全改成了Nginx,之前寫的.htaccess就沒用了,需要設定在conf裡
原本的.htaccess
RewriteEngine on RewriteBase / RewriteCond $1 !^(index\.php|images|robots\.txt|$) RewriteRule ^(.*)$ index.php/$1 [L,QSA]
nginx的conf
server {
server_name 填入你的domain name;
root /var/www/codeigiter; //CI Application位置
index index.html index.php;
# set expiration of assets to MAX for caching
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
expires max;
log_not_found off;
}
location / {
# 檢查是否有這個檔案或資料夾存在,不存在則使用index.php內容
try_files $uri $uri/ /index.php;
}
location ~* \.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi.conf;
}
}
文章標籤
全站熱搜
留言列表
