server { server_name onepage.sg.com.cn t.sg.com.cn kinfolk.sg.com.cn ok.sg.com.cn jm.sg.com.cn; listen 80; allow all; autoindex off; set $charset utf-8; charset $charset; set $rootdir /data/web/onepage/project; if ( $host ~* "^([^\.]+)\.sg\.com\.cn$" ) { set $project $1; } if ( $project ~* onepage ) { set $project sg; } set $rootdir $rootdir/$project; root $rootdir; index index.php index.html; rewrite ^/admin$ /index.php?c=admin_index last; rewrite ^/$ /index.php?c=index last; location = /kissy-versions.php { root /data/web/onepage/kissy; rewrite ^/kissy-versions.php$ /versions.js break; expires 10m; } location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules } location ~ ^(.*)$ { # fastcgi_split_path_info ^(.+\.php)(/.+)$; # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini # With php5-cgi alone: #fastcgi_pass 127.0.0.1:9000; # With php5-fpm: fastcgi_param SCRIPT_FILENAME $document_root/index.php; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include onepage_fastcgi_params; } } server { listen 80; server_name opcdn.sg.com.cn; allow all; autoindex off; concat on; concat_max_files 40; location ^~ /k/ { root /data/web/onepage/kissy; rewrite ^/k/(.*)$ /$1 break; expires 30d; } location ^~ /public/ { add_header Access-Control-Allow-Origin *; root /data/web/onepage/kissy; expires 1h; } }