nginx笔记 反向代理 负载均衡
nginx笔记 反向代理 负载均衡
nginx常用命令
/usr/local/webserver/nginx/sbin/nginx -s reload # 重新载入配置文件
/usr/local/webserver/nginx/sbin/nginx -s reopen # 重启 Nginx
/usr/local/webserver/nginx/sbin/nginx -s stop # 停止 Nginx
帮助
nginx -h
重载配置
nginx.exe -s reopen
重启
nginx.exe -s reload
nginx负载均衡_反向代理_配置备份
nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream group1{
server 127.0.0.1:8080 weight=5;
server 127.0.0.1:8082 weight=5;
}
server {
listen 80;
server_name localhost;
default_type text/html;
location / {
root html;
index index.html index.htm;
}
location /a/ {
proxy_pass https://www.runoob.com/linux/nginx-install-setup.html;
}
location /b/ {
proxy_pass http://group1/;
}
}
}
nginx_tcp_反向代理
nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
stream{
upstream tcp_proxy{
server 192.168.1.100:8022;
}
server{
listen 2222;
proxy_pass tcp_proxy;
}
}