nginx命令
先进入nginx.exe所在文件夹
cd D:\nginx
常用命令如下
D:\nginx>start nginx ---启动 D:\nginx>nginx -s reload ---重新加载配置 D:\nginx>tasklist /fi "imagename eq nginx.exe ---查看nginx进程 D:\nginx>nginx -s stop ---停止
杀掉nginx进程
D:\nginx>taskkill /f /pid 16900 /pid 19012
nginx代理rtsp视频流资源
stream { upstream backend { server 10.3.251.51:554; } server { listen 554; proxy_pass backend; } } 负载均衡代理 stream { upstream kube-apiserver { server 192.168.10.64:6443 max_fails=3 fail_timeout=30s; server 192.168.10.65:6443 max_fails=3 fail_timeout=30s; } server { listen 7443; proxy_connect_timeout 2s; proxy_timeout 900s; proxy_pass kube-apiserver; } }
反向代理SQLSERVER数据库
stream{ server{ listen 14331; proxy_connect_timeout 1s; proxy_timeout 3s; proxy_pass sqlserver; } server{ listen 14332; proxy_connect_timeout 1s; proxy_timeout 3s; proxy_pass sqlserver1; } upstream sqlserver{ server 172.168.100.7:11433 weight=1 max_fails=2 fail_timeout=30s; } upstream sqlserver1{ server 172.168.100.6:11433 weight=1 max_fails=2 fail_timeout=30s; } }
nginx代理https
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#gzip on;
client_max_body_size 500m;
server {
listen 8500;
server_name 127.0.0.1;
location / {
#设置主机头和客户端真实地址,以便服务器获取客户端真实IP
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#禁用缓存
proxy_buffering off;
#设置反向代理的地址
proxy_pass http://111.111.111.111:8500;
}
}
add_header Access-Control-Allow-Origin *;
add_header 'Access-Control-Allow-Credentials' "true";
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow-Methods *;
}