nginx

  • 启动
    start nginx
  • 正常停止
    nginx -s quit
  • 快速停止
    nginx -s stop

代理

地址

1
2
3
4
5
6
7
8
9
server {
    listen       9001;
    server_name  192.168.1.10;

    location /11/ {
        #192.168.1.10:9001/11/test -> http://192.168.1.11:8080/test
        proxy_pass http://192.168.1.11:8080/;
    }
}

服务器

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
stream {    #stream模块与http模块处于同一级;stream模块编译后需要手动添加;这两个模块可以共存。
    upstream remote01{    
        server 192.168.1.11:22;
    }

    server {
        listen 2201;
        proxy_connect_timeout 1h;
        proxy_timeout 1h;
        proxy_pass remote01;
    }
}

文件下载

1
2
3
4
5
6
location /file {
    alias /test/; 	# 文件存放目录,注意要以 '/' 结尾;
    index index.html;  		    # 如果文件存放目录有 index.html,会跳转到 index.html;
    autoindex on;               # 自动列出目录下的文件;
    autoindex_exact_size off;   # 文件大小按 G、M 的格式显示,而不是 Bytes;
}