[root@tiejiangSRC1 nginx] # vim conf/nginx.conf user www www; worker_processes 8; worker_rlimit_nofile 65535; pid logs/nginx.pid; events { worker_connections 65535; use epoll; } error_log /usr/local/nginx/logs/error.log info; http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; charset gb2312; server_names_hash_max_size 2048; server_names_hash_bucket_size 256; client_header_buffer_size 256k; client_max_body_size 100m; large_client_header_buffers 4 256k; sendfile on; tcp_nopush on; server_tokens off; tcp_nodelay on; proxy_send_timeout 300; proxy_read_timeout 300; proxy_buffer_size 4k; proxy_buffers 16 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k; proxy_connect_timeout 30s; keepalive_timeout 10; # 开启压缩功能 gzip on; gzip_http_version 1.0; gzip_min_length 1100; gzip_comp_level 3; gzip_buffers 4 32k; gzip_types text/plain text/xml text/css application/x-javascript application/xml application/xml+rss text/javascript application/atom+xml; ignore_invalid_headers on; client_header_timeout 3m; client_body_timeout 3m; send_timeout 3m; connection_pool_size 256; request_pool_size 32k; output_buffers 4 64k; postpone_output 1460; open_file_cache max=1000 inactive=300s; open_file_cache_valid 600s; open_file_cache_min_uses 2; open_file_cache_errors off; include "/usr/local/nginx/conf/vhosts/*.conf" ; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"' ;access_log logs/access.log main; } [root@tiejiangSRC1 nginx] # vim conf/vhosts/vhost1.conf server{ listen 80; server_name 192.168.30.114; root /data/www; index index.html index.htm index.php; if (-d $request_filename) { rewrite ^/(.*)([^/])$ http: //$host/$1$2/ permanent; } #所有php的页面均交由apache处理 location ~ \.(php)?$ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http: //192.168.30.114:81; } } |