Nginx配置文件需要我们学习的东西有很多,但是要想一下子学会这么多东西是不可能的,那么我们就来重点的学习有关Nginx配置文件的经典教程,希望大家在学习中掌握技巧。
userwwwwww;
序列号 | CPU | RAM | HDD | 带宽 | 售价(美元) | 免费试用 |
---|---|---|---|---|---|---|
香港服务器1 | E5-2620 | 32G | 1T HDD | 50M/无限流量 | $196.00 | 立即申请 |
香港服务器2 | E5-2650 | 32G | 1T HDD | 50M/无限流量 | $256.00 | 立即申请 |
香港服务器3 | E5-2680 | 32G | 1T HDD | 50M/无限流量 | $316.00 | 立即申请 |
香港服务器4 | E5-2690 | 32G | 1T HDD | 50M/无限流量 | $336.00 | 立即申请 |
香港服务器5 | E5-2697 | 32G | 1T HDD | 50M/无限流量 | $376.00 | 立即申请 |
香港服务器6 | E5-2620*2 | 32G | 1T HDD | 50M/无限流量 | $376.00 | 立即申请 |
香港服务器7 | E5-2650*2 | 32G | 1T HDD | 50M/无限流量 | $436.00 | 立即申请 |
香港服务器8 | E5-2680*2 | 32G | 1T HDD | 50M/无限流量 | $476.00 | 立即申请 |
香港服务器9 | E5-2690*2 | 32G | 1T HDD | 50M/无限流量 | $556.00 | 立即申请 |
香港服务器10 | E5-2697*2 | 32G | 1T HDD | 50M/无限流量 | $596.00 | 立即申请 |
香港服务器11 | E5-2680v4*2 | 32G | 1T HDD | 50M/无限流量 | $696.00 | 立即申请 |
香港服务器12 | E5-2698v4*2 | 32G | 1T HDD | 50M/无限流量 | $796.00 | 立即申请 |
worker_processes2;
pid/var/run/nginx.pid;
#[debug|info|notice|warn|error|crit]
error_log/var/log/nginx.error_loginfo;
events{
worker_connections2000;
#use[kqueue|rtsig|epoll|/dev/poll|select|poll];
usekqueue;
}
http{
includeconf/mime.types;
default_typeapplication/octet-stream;
log_formatmain'$remote_addr-$remote_user[$time_local]'
'"$request"$status$bytes_sent'
'"$http_referer""$http_user_agent"'
'"$gzip_ratio"';
log_formatdownload'$remote_addr-$remote_user[$time_local]'
'"$request"$status$bytes_sent'
'"$http_referer""$http_user_agent"'
'"$http_range""$sent_http_content_range"';
client_header_timeout3m;
client_body_timeout3m;
send_timeout3m;
client_header_buffer_size1k;
large_client_header_buffers44k;
gzipon;
gzip_min_length1100;
gzip_buffers48k;
gzip_typestext/plain;
output_buffers132k;
postpone_output1460;
sendfileon;
tcp_nopushon;
tcp_nodelayon;
send_lowat12000;
keepalive_timeout7520;
#lingering_time30;
#lingering_timeout10;
#reset_timedout_connectionon;
server{
listenone.example.com;
server_nameone.example.comwww.one.example.com;
access_log/var/log/nginx.access_logmain;
location/{
proxy_passhttp://127.0.0.1/;
proxy_redirectoff;
proxy_set_headerHost$host;
proxy_set_headerX-Real-IP$remote_addr;
#proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;
client_max_body_size10m;
client_body_buffer_size128k;
client_body_temp_path/var/nginx/client_body_temp;
proxy_connect_timeout90;
proxy_send_timeout90;
proxy_read_timeout90;
proxy_send_lowat12000;
proxy_buffer_size4k;
proxy_buffers432k;
proxy_busy_buffers_size64k;
proxy_temp_file_write_size64k;
proxy_temp_path/var/nginx/proxy_temp;
charsetkoi8-r;
}
error_page404/404.html;
location/404.html{
root/spool/www;
charseton;
source_charsetkoi8-r;
}
location/old_stuff/{
rewrite^/old_stuff/(.*)$/new_stuff/$1permanent;
}
location/download/{
valid_referersnoneblockedserver_names*.example.com;
if($invalid_referer){
#rewrite^/http://www.example.com/;
return403;
}
#rewrite_logon;
#rewrite/download/*/mp3/*.any_extto/download/*/mp3/*.mp3
rewrite^/(download/.*)/mp3/(.*)..*$/$1/mp3/$2.mp3break;
root/spool/www;
#autoindexon;
access_log/var/log/nginx-download.access_logdownload;
}
location~*^.+.(jpg|jpeg|gif)${
root/spool/www;
access_logoff;
expires30d;
}
}
}
以上就是对Nginx配置文件的详细介绍,希望大家在使用中有所收获。