安装

1
2
3
4
5
wget http://nginx.org/download/nginx-1.20.0.tar.gz
tar -zxvf nginx-1.20.0.tar.gz
cd nginx-1.20.0
./configure --prefix=/usr/local/nginx --with-http_ssl_module
make && make install

配置

配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
server {
listen 80;
server_name 47.93.225.255;
location / {
proxy_pass http://127.0.0.1:5000;
}
}
server {
listen 81;
server_name 47.93.225.255;
location / {
proxy_pass http://127.0.0.1:5001;
}
}

使用

1
2
3
4
5
6
# 启动
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
# 重启
/usr/local/nginx/sbin/nginx -s reload
# 停止
/usr/local/nginx/sbin/nginx -s stop