$ cat /etc/nginx/conf.d/default.conf
server { ... } 為一個網站配置單位,Nginx要支援 PHP 需要另外安裝php5-fpm
server {
client_max_body_size 10M;
server_name dev.unicloud.com.tw;
root /var/www/gpd.admin/public;
index index.php index.html index.htm;
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
#expires max;
expires 0;
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}