ser www www; worker_processes 16; error_log /data/logs/nginx/nginx_error.log crit; pid /opt/nginx/nginx.pid; #Specifies the value for maximum file descriptors that can be opened by this process. worker_rlimit_nofile 65535; events { use epoll; worker_connections 65535; } http { include mime.types; default_type application/octet-stream; server_tokens off; charset utf8; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; client_max_body_size 8m; sendfile on; tcp_nopush on; keepalive_timeout 60; tcp_nodelay on; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.0; gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml; gzip_vary on; #limit_zone crawler $binary_remote_addr 10m; log_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for'; include vhosts/*.conf; }
上面这是主文件
接下来 虚拟主机文件
server { listen 80; server_name games.kkguo.com; index index.php index.html; root /data/htdocs/private_new_kkguo/sites/www; location ~ /.svn/ { deny all; } location / { if (!-e $request_filename){ rewrite /. /index.php last; } } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; include fastcgi.conf; } access_log /data/logs/nginx/games.kkguo.com.log access; error_log /data/logs/nginx/nginx_error.log; } server { listen 80; server_name api.kkguo.com; index index.php; root /data/htdocs/private_new_kkguo/sites/api; location ~ /.svn/ { deny all; } location / { if (!-e $request_filename){ rewrite /. /index.php last; } } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; include fastcgi.conf; } access_log /data/logs/nginx/api.kkguo.com.log access; error_log /data/logs/nginx/nginx_error.log; } server { listen 80; server_name ns.kkguo.com rxhzw.kkguo.com zxy.kkguo.com sxd.kkguo.com jtzs.kkguo.com smxj.kkguo.com frxz2.kkguo.com dpcq.kkguo.com ddz.kkguo.com mhfx.kkguo.com mjcs.kkguo.com lc.kkguo.com gzmy.kkguo.com lj.kkguo.com 6d.kkguo.com xxhzw.kkguo.com aszt.kkguo.com bd.kkguo.com hp2.kkguo.com blcx.kkguo.com mjh.kkguo.com xlfc.kkguo.com jzwc.kkguo.com djj.kkguo.com dxz.kkguo.com plqt.kkguo.com tj.kkguo.com jjsg.kkguo.com; index index.php; root /data/htdocs/private_new_kkguo/sites/game; location ~ /.svn/ { deny all; } location / { if (!-e $request_filename){ rewrite /. /index.php last; } } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; include fastcgi.conf; } access_log /data/logs/nginx/games.kkguo.com.log access; error_log /data/logs/nginx/nginx_error.log; } server { listen 80; server_name bbs.kkguo.com; index index.php; root /data/htdocs/private_new_kkguo/sites/bbs; location ~ /.svn/ { deny all; } location / { if (!-e $request_filename){ rewrite /. /index.php last; } } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; include fastcgi.conf; } access_log /data/logs/nginx/bbs.kkguo.com.log access; error_log /data/logs/nginx/nginx_error.log; } server { listen 80; server_name cp.kkguo.com newcp.kkguo.com; index index.php; root /data/htdocs/private_new_kkguo/sites/cp; location ~ /.svn/ { deny all; } location / { if (!-e $request_filename){ rewrite /. /index.php last; } } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; include fastcgi.conf; } access_log /data/logs/nginx/cp.kkguo.com.log access; error_log /data/logs/nginx/nginx_error.log; } server { listen 80; server_name pay.kkguo.com; index index.php; root /data/htdocs/private_new_kkguo/sites/pay; location ~ /.svn/ { deny all; } location / { if (!-e $request_filename){ rewrite /. /index.php last; } } location ~ \.php$ { location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; include fastcgi.conf; } access_log /data/logs/nginx/cp.kkguo.com.log access; error_log /data/logs/nginx/nginx_error.log; } server { listen 80; server_name phpmyadmin.kkguo.com; index index.php; root /data/htdocs/phpmyadmin; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; include fastcgi.conf; } access_log off; error_log /dev/null crit; } server { root /data/htdocs/private_new_kkguo/sites/static; index index.php index.html index.htm; server_name pic.kkguo.com static.kkguo.com; access_log off; } server { root /data/htdocs/private_kkguo_flow/webroot; index index.php index.html index.htm; server_name flow.kkguo.com cache.927027.com; # server_name flow.kkguo.com cache.qj-soft.com; location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ico|js|css)$ { expires 30d; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; include fastcgi.conf; } access_log off; error_log /dev/null crit; } server { listen 80; server_name *.kkguo.com kkguo.com; index index.html index.htm index.php; root /data/htdocs/kkguo/webroot; rewrite ^/(.*) http://games.kkguo.com/$1 last; access_log off; error_log /dev/null crit; }