1
ln -sf /usr/local/nginx/conf/nginx.conf /etc/nginx.conf
mkdir -p /etc/nginx/vhost
user www www;
worker_processes 4;
worker_cpu_affinity 1000 0100 0010 0001;


error_log /opt/log/nginx/error.log error;
pid /var/run/nginx.pid;


worker_rlimit_nofile 65535;

events
{
	use epoll;
	worker_connections 65535;
}


http
{
	include mime.types; 
	include fastcgi.conf;
	default_type application/octet-stream; 
	charset utf-8; 
	server_names_hash_bucket_size 128; 
	client_header_buffer_size 32k; 
	large_client_header_buffers 4 64k; 
	client_max_body_size 8m; 
	sendfile on;
	autoindex off; 
	tcp_nopush on; 
	tcp_nodelay on; 
	keepalive_timeout 30; 


	fastcgi_connect_timeout 60;
	fastcgi_send_timeout 60;
	fastcgi_read_timeout 60;
	fastcgi_buffer_size 128k;
	fastcgi_buffers 8 128k;
	fastcgi_busy_buffers_size 128k;
	fastcgi_temp_file_write_size 128k;


	gzip on; 
	gzip_min_length 5k; 
	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;
	
	log_format main '$remote_addr - $remote_user [$time_local] "$request" '
	'$status $body_bytes_sent "$http_referer" '
	'"$http_user_agent" $http_x_forwarded_for';
		
	include /etc/nginx/vhost/*.conf;
}

a

a

server {
        listen      80;
        server_name  estt.com.cn www.estt.com.cn ;
        root /var/www/estt;
        index  index.php index.html index.htm;

        #access_log  /opt/logs/nginx/estt/access.log;
        error_log  /opt/logs/nginx/error.log;

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root  html;
        }

        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }

        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }

        location / {
                # This is cool because no php is touched for static content.
                # include the "?$args" part so non-default permalinks doesn't break when using query string
                try_files $uri $uri/ /index.php?$args;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                expires max;
                log_not_found off;
        }

        location ~ .php$ {
            fastcgi_pass   127.0.0.1:9000;
        }

        location ~ /.ht {
            deny  all;
        }

}

a


a



转载请注明:半叶寒羽 » nginx配置篇