我拥有运行不同站点的服务器,我需要为这些域配置nginx反向代理(example1.com、example2.com、test.example1.com),其中dp需要为反向代理配置nginx中的域。
发布于 2018-10-25 07:17:19
多个server{}块和proxy_pass http://origin.server在location块中。
例如:
server {
test.example1.com;
location / {
proxy_pass http://origin.text.example1.com;
}
}
server {
server_name example1.com;
location / {
proxy_pass http://origin.example1.com;
}
}
server {
server_name example2.com;
location / {
proxy_pass http://origin.example2.com;
}
}nginx初学者指南和nginx文档中的服务器名称会帮你的。
还有更复杂的配置(包括/etc/nginx/sites启用/..conf、/etc/nginx/sites available /..conf),但这依赖于您的分发包。
https://serverfault.com/questions/937103
复制相似问题