启动Docker 容器
docker exec -it server1 bash
简单实例
最简配置
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
}
默认server与多域名配置
ruiyi.conf bspx.conf
www.mxs223.com:8080
118.24.25.216 test.bspx.net
118.24.25.216 test.ruiyi126.com
118.24.25.216 test2.ruiyi126.com
118.24.25.216 test1111.ruiyi126.com
server{
listen 80;
server_name test.bspx.net;
location /{
proxy_pass https://www.bspx.net/;
}
}
server{
listen 80 default_server;
server_name test.ruiyi16.net test2.ruiyi16.net;
location /{
proxy_pass https://www.ruiyi126.com/;
}
}
nginx.conf中的server
1、每一个server,对应一个监听port端口,一个ip/域名
2、nginx里面可配置多个server,多个upstream
3、每个server配置多个location
4、一般配置方式:
在/etc/nginx/con.d/目录下,放置多个server配置文件,每个配置文件里仅含一个server配置。
然后在主配置nginx.conf中: include 文件夹下所以server配置 ==== jsp/freemaker里的include