How to setup mass dynamic virtual hosts in nginx?

前端 未结 7 1800
借酒劲吻你
借酒劲吻你 2021-01-30 09:42

Been playing with nginx for about an hour trying to setup mass dynamic virtual hosts. If you ever done it in apache you know what I mean.

Goal is to have dynamic subdom

7条回答
  •  鱼传尺愫
    2021-01-30 10:17

    As @Samuurai suggested here is a short version Angular 5 with nginx build integration:

    server {
        server_name ~^(?.*)\.staging\.yourdomain\.com$;
        access_log /var/log/nginx/branch-access.log;
        error_log /var/log/nginx/branch-error.log;
        index index.html;
        try_files $uri$args $uri$args/ $uri $uri/ /index.html =404;
        root /usr/share/nginx/html/www/theft/$branch/dist;
    }
    

提交回复
热议问题