[英]NginX as HTTPS reverse proxy for multiple sub-domains?
I have one IP address on my Linux box, and would like to serve HTTPS websites in this form: 我的Linux机器上有一个IP地址,并希望以这种形式为HTTPS网站提供服务:
https://landing.example.com
https://site-01.example.com/index.html
https://site-01.example.com/files/index.html
https://site-01.example.com/store/index.html
https://site-02.example.com/index.html
https://site-02.example.com/files/index.html
https://site-02.example.com/store/index.html
Each of these websites is a Docker container on the same host, so my idea were setting up an NginX reverse proxy Docker container. 这些网站中的每一个都是同一主机上的Docker容器,因此我的想法是设置NginX反向代理Docker容器。
There are many howto's about NginX as reverse proxy, but what I want to do is different from the text book example, as I have HTTPS, multiple sub-domains and multiple URL's. 关于NginX作为反向代理的方法有很多,但是我想做的事情与课本示例不同,因为我有HTTPS,多个子域和多个URL。
Questions 问题
Does anyone know of howto's that deal with this type of setup, or perhaps can tell me what the technical key words I should search for are? 有谁知道如何处理这种类型的设置,或者可以告诉我应该搜索哪些技术关键词?
At this point I don't know where to start, so any help will be much appreciated. 目前,我不知道从哪里开始,所以我们将不胜感激。
You need to add A-records to you DNS manager that will redirect all your subdomains to the IP address of the host machine. 您需要向DNS管理器中添加A记录,该记录会将您的所有子域重定向到主机的IP地址。 Then in your NGINX config you can do something like this. 然后,在您的NGINX配置中,您可以执行以下操作。
server {
listen 80;
server_name landing.example.com;
location /static {
alias /home/example-dir/staticfiles;
}
access_log /home/example-dir/nginx-access.log;
error_log /home/example-dir/nginx-error.log info;
}
server {
listen 80;
server_name site-01.example.com;
location /static {
alias /home/example-dir2/staticfiles;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.