nginx做反向代理结合apache

发布时间:2014-10-25 2:24:13
来源:分享查询网

 tar zxvf pcre-7.8.tar.gzcd pcre-7.8/./configuremake && make installcd ../tar zxvf nginx-0.6.35.tar.gzcd nginx-0.6.35/./configure --user=apache --group=apache --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_modulemake && make installmkdir -p /var/log/nginxchmod +w /var/log/nginxchown -R apache:apache /var/log/nginxrm -f /usr/local/nginx/conf/nginx.confvi /usr/local/nginx/conf/nginx.confnginx.conf########################################################user apache apache; worker_processes 8; error_log /var/log/nginx/nginx_error.log crit; pid /usr/local/nginx/logs/nginx.pid; worker_rlimit_nofile 51200; events { use epoll; worker_connections 51200; } http { include mime.types; default_type application/octet-stream; #charset gb2312; 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 65; tcp_nodelay on; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.0; gzip_comp_level 2; gzip_types application/x-javascript text/css application/xml; gzip_vary on; upstream xx.server { server 127.0.0.1:80; } server { listen 8080; server_name www.xxx.com xxx.com root /var/www/html/xxx.com/www.xxx.com; index index.html index.htm index.php; log_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for'; #access_log /data1/logs/access.log access; access_log off; location / { proxy_pass http://xx.server; include proxy.conf; } location ~ .*/.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*/.(js|css|html|htm|ico)?$ { expires 1h; } } } ########################################################proxy.conf########################################################proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90;proxy_read_timeout 90;proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k;########################################################启动# ulimit -SHn 51200# /usr/local/nginx/sbin/nginx关闭# ps aux|grep nginx# kill pid xxxx

返回顶部
查看电脑版