nginx配置反向代理,负载均衡配置;
upstreamqq_com {
ip_hash;
server127.0.0.1:8080;
server127.0.0.1:8081;
}
server {
listen80;
server_namewww.qq.com;
location/
{
proxy_passhttp://qq_com;
proxy_set_headerHost$host;
proxy_set_headerX-Real-IP$remote_addr;
proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;
}
}
nginx 配置SSL
server
{
listen443;
server_namea.com;
indexindex.htmlindex.php;
root/data/nginx/a.com;
sslon;
ssl_certificatecert/215058855400123.pem;
ssl_certificate_keycert/215058855400123.key;
ssl_protocolsTLSv1TLSv1.1TLSv1.2;
location/{
root/home/www/a.com;
indexindex.htmlindex.htm;
}
access_log/tmp/1.logcombined_realip;
}
nginx 配置静态目录
server{
listen8088;
server_namelocalhost;
charsetkoi8-r;
access_loglogs/host.access.logmain;
location~.*.(gif|jpg|jpeg|png)${
expires24h;
rootusr/local/image/;#指定图片存放路径
access_logusr/local/image/images.log;#日志存放路径
proxy_storeon;
proxy_store_accessuser:rwgroup:rwall:rw;
proxy_temp_pathsr/local/image/;#图片访问路径
proxy_redirectoff;
proxy_set_headerHost127.0.0.1;
client_max_body_size10m;
client_body_buffer_size1280k;
proxy_connect_timeout900;
proxy_send_timeout900;
proxy_read_timeout900;
proxy_buffer_size40k;
proxy_buffers40320k;
proxy_busy_buffers_size640k;
proxy_temp_file_write_size640k;
if(!-e$request_filename)
{
proxy_passhttp://127.0.0.1;
}
}
nginx 用户认证
server
{
listen80;
server_nametest.com;
index index.htmlindex.htmindex.php;
root/data/wwwroot/test.com;
location/
{
auth_basic"Auth";
auth_basic_user_file/usr/local/nginx/conf/htpasswd;
}
}
yuminstall-yhttpd
htpasswd-c/usr/local/conf/htpasswdaming
./nginx-sreload
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。