Nginx :支持高并发量, (采用epol kqueuel网络模型) 内存消耗小,支持反向代理和负载均衡。
1.下载 nginx-1.5.10的Windows版本,解压,改名nginx.操作:cd nginx start nginx
打开任务管理器,查看nginx.exe 进程(有二个). 查看http://127.0.0.1/ 。
nginx -s stop //
停止nginx
nginx -s reload //
重新加载配置文件
nginx -s quit
// 退出nginx
2.配置conf。
worker_processes 1 有几个cpu 就用几个工作进程
events {
worker_connections 1024;
}
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;
sendfile
on;
keepalive_timeout 65
server {
listen
80;
server_name
localhost;
location ~*
software/(.*).*\.(jpg|rar)
{
expires
21d;
root
d:/temp/;
access_log
d:/temp/soft.3g.cn_nginx_s3gd-205.log;
proxy_store on;
proxy_store_access user:rw group:rw
all:rw;
proxy_temp_path
d:/temp/;
proxy_redirect
off;
proxy_set_header Host
112.25.10.140;
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 1280k;
proxy_connect_timeout 900;
proxy_send_timeout 900;
proxy_read_timeout 900;
proxy_buffer_size 40k;
proxy_buffers
40 320k;
proxy_busy_buffers_size 640k;
proxy_temp_file_write_size 640k;
if ( !-e
$request_filename)
{
proxy_pass http://112.25.10.140:80;
}
}
location /
{
root
html;
index index.html index.htm;
}
error_page 500 502 503 504
/50x.html;
location = /50x.html
{
root html;
}