server { # access_log /alidata/server/nginx/logs/default.log; error_log /alidata/server/nginx/logs/default_error.log; # access_log on # error_log off; listen 80; server_name localhost; root /alidata/www/; charset utf-8; location / { index index.html index.php; try_files $uri $uri/ /index.php?$args; } location ~ ^/(protected|framework|themes/\w+/views) { deny all; } #avoid processing of calls to unexisting static files by yii location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { expires 30d; try_files $uri =404; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php { fastcgi_split_path_info ^(.+\.php)(.*)$; #let yii catch the calls to unexising PHP files set $fsn /index.php; if (-f $document_root$fastcgi_script_name){ set $fsn $fastcgi_script_name; } fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; fastcgi_param SCRIPT_FILENAME $document_root$fsn; #PATH_INFO and PATH_TRANSLATED can be omitted, but RFC 3875 specifies them for CGI fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fsn; } # prevent nginx from serving dotfiles (.htaccess, .svn, .git, etc.) location ~ /\. { deny all; access_log off; log_not_found off; } }