Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Latest commit

 

History

History
48 lines (41 loc) · 1.14 KB

Nginx.md

File metadata and controls

48 lines (41 loc) · 1.14 KB

Nginx

如果你需要在TeaWeb前面需要加一个nginx代理,类似于以下结构:

[用户] <--> [nginx] <--> [TeaWeb] <--> Backends

可以代理服务设置中的"前端代理"中查看自动生成的nginx配置: nginx.png

然后将配置加入到nginxnginx.conf中:

http {
    ...
    
    server {
        # nginx address
        listen 80;
        server_name example.cn;
        ...
    }
}

可以根据自己的需要修改上面配置中的listennginx监听地址)和server_name(供用户访问的域名)。

使用include指令

也可以将配置文件保存成 xxx.conf(将xxx改成一个有意义的文件名,英文字母和数字的组合),然后在nginx.conf中配置:

http {
    ...
    
    include /这里是绝对路径/xxx.conf;
}

重载nginx配置

如果要想nginx配置生效,需要重载或者重启nginx

重载

sbin/nginx -t  # 检查nginx配置是否正确
sbin/nginx -s reload

重启

sbin/nginx -t  # 检查nginx配置是否正确
sbin/nginx -s stop # 停止nginx
sbin/nginx # 启动nginx