ถ้าผมอยากให้เว็บที่ผมสร้างมาจะเป็นแนว web builder และอยากให้ User สามารถ Custom domain ได้ ผมต้องเรียนรู้เรื่องอะไรบ้างครับและผมสามารถใช้ service ตัวไหนมาช่วยจัดการได้บ้างครับ (ถ้าเป็น azure จะดีมากๆ ครับ)

ตัวอย่างของ wix ที่ให้ user custom domain ได้ครับ

Hiring! บริษัทที่น่าสนใจ

Carmen Software company cover
Carmen Software
Hotel Financial Solutions
Next Innovation (Thailand) Co., Ltd. company cover
Next Innovation (Thailand) Co., Ltd.
We are web design with consulting & engineering services driven the future stronger and flexibility.
KKP Dime company cover
KKP Dime
KKP Dime บริษัทในเครือเกียรตินาคินภัทร
Kiatnakin Phatra Financial Group company cover
Kiatnakin Phatra Financial Group
Financial Service
Fastwork Technologies company cover
Fastwork Technologies
Fastwork.co เว็บไซต์ที่รวบรวม ฟรีแลนซ์ มืออาชีพจากหลากหลายสายงานไว้ในที่เดียวกัน
Thoughtworks Thailand company cover
Thoughtworks Thailand
Thoughtworks เป็นบริษัทที่ปรึกษาด้านเทคโนโยลีระดับโลกที่คว้า Great Place to Work 3 ปีซ้อน
Iron Software company cover
Iron Software
Iron Software is an American company providing a suite of .NET libraries by engineer for engineers.
CLEVERSE company cover
CLEVERSE
Cleverse is a Venture Builder. Our team builds several tech companies.
Nipa Cloud company cover
Nipa Cloud
#1 OpenStack cloud provider in Thailand with our own data center and software platform.
Bangmod Enterprise company cover
Bangmod Enterprise
The leader in Cloud Server and Hosting in Thailand.
CIMB THAI Bank company cover
CIMB THAI Bank
MOVING FORWARD WITH YOU - CIMB is the leading ASEAN Bank
Bangkok Bank company cover
Bangkok Bank
Bangkok Bank is one of Southeast Asia's largest regional banks, a market leader in business banking
MuvMi (Urban Mobility Tech Co.,Ltd.) company cover
MuvMi (Urban Mobility Tech Co.,Ltd.)
Shape the future of urban mobility towards affordable, clean, and safe solutions
T.N. Digital Solution Co., Ltd. company cover
T.N. Digital Solution Co., Ltd.
TNDS has been involving in every first move of banking’s major digital transformation.
KBTG - KASIKORN Business-Technology Group company cover
KBTG - KASIKORN Business-Technology Group
KBTG - "The Technology Company for Digital Business Innovation"
Siam Commercial Bank Public Company Limited company cover
Siam Commercial Bank Public Company Limited
"Let's start a brighter career future together"
Icon Framework co.,Ltd. company cover
Icon Framework co.,Ltd.
Global Standard Platform for Real Estate แพลตฟอร์มสำหรับธุรกิจอสังหาริมทรัพย์ครบวงจร มาตรฐานระดับโลก
REFINITIV company cover
REFINITIV
The Financial and Risk business of Thomson Reuters is now Refinitiv
H LAB company cover
H LAB
Re-engineering healthcare systems through intelligent platforms and system design.
The Gang Technology Co., Ltd. company cover
The Gang Technology Co., Ltd.
We're a Digital Agency that helps our customers transform their business into digital with ease.
LTMH company cover
LTMH
LTMH มุ่งเน้นการพัฒนาผลิตภัณฑ์ที่สามารถช่วยพันธมิตรของเราให้บรรลุเป้าหมาย
Seven Peaks company cover
Seven Peaks
We Drive Digital Transformation
Wisesight (Thailand) Co., Ltd. company cover
Wisesight (Thailand) Co., Ltd.
The Best Choice For Handling Social Media · High Expertise in Social Data · Most Advanced and Secure
MOLOG Tech company cover
MOLOG Tech
We are Modern Logistic Platform, Specialize in WMS, OMS and TMS.
Data Wow Co.,Ltd company cover
Data Wow Co.,Ltd
We enable our clients to realize increased productivity by solving their most complex issues by Data
LINE Company Thailand company cover
LINE Company Thailand
LINE, the world's hottest mobile messaging platform, offers free text and voice messaging + Call
LINE MAN Wongnai company cover
LINE MAN Wongnai
Join our journey to becoming No.1 food platform in Thailand

ตั้งแต่ cloud infrastructure เลยล่ะ และก็พวก building process, build automation, content delivery, automate certification และอีกเพียบที่ผมยังไม่รู้ แต่มาบอกเท่าที่รู้

แต่ถ้าจะมาทำพวกนี้ บอกเลยสู้เจ้าใหญ่ยากมาก ฝั่งเขาคุมตั้งแต่ต้นยันปลาย เครื่องก็มีของตัวเองด้วยซ้ำ มี CA มี CDN เป็นของตัวเองไว้บริการ

lancaster Mon, 01/08/2022 - 01:52

assume ว่าสามารถทำเว็บแบบไม่ custom domain ได้แล้วนะครับ ควรจะเข้าใจเรื่อง backend webdev + linux webserver config เบื้องต้นระดับนึง ที่ต้องศึกษาเพิ่มจะมีตามนี้ครับ

  1. HTTP Protocol
  2. HTTP Host Header -- เอาให้ฝั่ง backend app ไว้อ่านว่าผู้ใช้เค้าเข้าจากโดเมนชื่ออะไร
  3. nginx vhost (server_name) -- เอาไว้คอนฟิก web server ให้รับโดเมนได้หลายชื่อ หรือจะไม่ใส่เลยก็ได้ให้มันรับหมด
    • ถ้าใช้ web server อื่น ก็ลองหาด้วย keyword ของ web server นั้นครับ

คุณต้องเขียนโปรแกรมสำหรับ generate webserver application configuration files ครับ
อย่างถ้าใช้ Nginx เป็น webserver application คุณก็ต้องเขียนโปรแกรม generate config ของ Nginx ครับ

แต่คุณจะศึกษาแค่ Nginx อย่างเดียวไม่ได้ มันมีเรื่องที่เกี่ยวข้องอีก อย่าง socket programming, Protocol, file system (read/write permission, owner) etc

ตัวอย่าง config domain and subdomain for Nginx (generate by Plesk)

# configuration file /etc/nginx/nginx.conf:

#user  nginx;
worker_processes 8;

error_log off;
#error_log  /var/log/nginx/error.log;
#error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;

#pid        /var/run/nginx.pid;

worker_rlimit_nofile 30000;

events {
    worker_connections  8096;
    multi_accept        on;
    use                 epoll;
}

http {
 
    include /etc/nginx/conf.d/*.conf;
}

# configuration file /etc/nginx/plesk.conf.d/vhosts/develop-nordic.de.conf:
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

server {
        listen 185.207.231.127:443 ssl http2;

        server_name develop-nordic.de;
        server_name www.develop-nordic.de;
        server_name ipv4.develop-nordic.de;

        ssl_certificate             /usr/local/psa/var/certificates/scf6T9Yal;
        ssl_certificate_key         /usr/local/psa/var/certificates/scf6T9Yal;

        client_max_body_size 134217728;

        access_log "/var/www/vhosts/system/develop-nordic.de/logs/proxy_access_ssl_log";
        error_log "/var/www/vhosts/system/develop-nordic.de/logs/proxy_error_log";

        root "/var/www/vhosts/develop-nordic.de/httpdocs";

        #extension letsencrypt begin
        location ^~ /.well-known/acme-challenge/ {
                root /var/www/vhosts/default/htdocs;

                types { }
                default_type text/plain;

                satisfy any;
                auth_basic off;
                allow all;

                location ~ ^/\.well-known/acme-challenge.*/\. {
                        deny all;
                }
        }
        #extension letsencrypt end

        #extension sslit begin

        #extension sslit end

        location / {
                proxy_pass https://185.207.231.127:7081;
                proxy_hide_header upgrade;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header X-Accel-Internal /internal-nginx-static-location;
                access_log off;

        }

        location /internal-nginx-static-location/ {
                alias /var/www/vhosts/develop-nordic.de/httpdocs/;
                internal;
        }

        location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
                proxy_pass https://185.207.231.127:7081;
                proxy_hide_header upgrade;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header X-Accel-Internal /internal-nginx-static-location;
                access_log off;

        }

        location ~ "^/projects/shopware/" {
                proxy_pass https://185.207.231.127:7081;
                proxy_hide_header upgrade;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header X-Accel-Internal /internal-nginx-static-location;
                access_log off;

        }

        add_header X-Powered-By PleskLin;

}

server {
        listen 185.207.231.127:80;

        server_name develop-nordic.de;
        server_name www.develop-nordic.de;
        server_name ipv4.develop-nordic.de;

        client_max_body_size 134217728;

        access_log "/var/www/vhosts/system/develop-nordic.de/logs/proxy_access_log";
        error_log "/var/www/vhosts/system/develop-nordic.de/logs/proxy_error_log";

        root "/var/www/vhosts/develop-nordic.de/httpdocs";

        #extension letsencrypt begin
        location ^~ /.well-known/acme-challenge/ {
                root /var/www/vhosts/default/htdocs;

                types { }
                default_type text/plain;

                satisfy any;
                auth_basic off;
                allow all;

                location ~ ^/\.well-known/acme-challenge.*/\. {
                        deny all;
                }
        }
        #extension letsencrypt end

        #extension sslit begin

        #extension sslit end

        location / {
                proxy_pass http://185.207.231.127:7080;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header X-Accel-Internal /internal-nginx-static-location;
                access_log off;

        }

        location /internal-nginx-static-location/ {
                alias /var/www/vhosts/develop-nordic.de/httpdocs/;
                internal;
        }

        location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
                proxy_pass http://185.207.231.127:7080;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header X-Accel-Internal /internal-nginx-static-location;
                access_log off;

        }

        location ~ "^/projects/shopware/" {
                proxy_pass http://185.207.231.127:7080;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header X-Accel-Internal /internal-nginx-static-location;
                access_log off;

        }

        add_header X-Powered-By PleskLin;

}
# configuration file /etc/nginx/plesk.conf.d/vhosts/shopware5.develop-nordic.de.conf:
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

server {
        listen 185.207.231.127:443 ssl http2;

        server_name shopware5.develop-nordic.de;
        server_name www.shopware5.develop-nordic.de;
        server_name ipv4.shopware5.develop-nordic.de;

        ssl_certificate             /usr/local/psa/var/certificates/scf52GmkR;
        ssl_certificate_key         /usr/local/psa/var/certificates/scf52GmkR;

        client_max_body_size 128m;

        root "/var/www/vhosts/develop-nordic.de/shopware5.develop-nordic.de/shopware5";
        access_log "/var/www/vhosts/system/shopware5.develop-nordic.de/logs/proxy_access_ssl_log";
        error_log "/var/www/vhosts/system/shopware5.develop-nordic.de/logs/proxy_error_log";

        #extension letsencrypt begin
        location ^~ /.well-known/acme-challenge/ {
                root /var/www/vhosts/default/htdocs;

                types { }
                default_type text/plain;

                satisfy any;
                auth_basic off;
                allow all;

                location ~ ^/\.well-known/acme-challenge.*/\. {
                        deny all;
                }
        }
        #extension letsencrypt end

        #extension sslit begin

        #extension sslit end

        location / {
                proxy_pass https://185.207.231.127:7081;
                proxy_hide_header upgrade;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header X-Accel-Internal /internal-nginx-static-location;
                access_log off;

        }

        location /internal-nginx-static-location/ {
                alias /var/www/vhosts/develop-nordic.de/shopware5.develop-nordic.de/shopware5/;
                internal;
        }

        location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
                proxy_pass https://185.207.231.127:7081;
                proxy_hide_header upgrade;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header X-Accel-Internal /internal-nginx-static-location;
                access_log off;

        }

        add_header X-Powered-By PleskLin;

}

server {
        listen 185.207.231.127:80;

        server_name shopware5.develop-nordic.de;
        server_name www.shopware5.develop-nordic.de;
        server_name ipv4.shopware5.develop-nordic.de;

        client_max_body_size 128m;

        root "/var/www/vhosts/develop-nordic.de/shopware5.develop-nordic.de/shopware5";
        access_log "/var/www/vhosts/system/shopware5.develop-nordic.de/logs/proxy_access_log";
        error_log "/var/www/vhosts/system/shopware5.develop-nordic.de/logs/proxy_error_log";

        #extension letsencrypt begin
        location ^~ /.well-known/acme-challenge/ {
                root /var/www/vhosts/default/htdocs;

                types { }
                default_type text/plain;

                satisfy any;
                auth_basic off;
                allow all;

                location ~ ^/\.well-known/acme-challenge.*/\. {
                        deny all;
                }
        }
        #extension letsencrypt end

        #extension sslit begin

        #extension sslit end

        location / {
                proxy_pass http://185.207.231.127:7080;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header X-Accel-Internal /internal-nginx-static-location;
                access_log off;

        }

        location /internal-nginx-static-location/ {
                alias /var/www/vhosts/develop-nordic.de/shopware5.develop-nordic.de/shopware5/;
                internal;
        }

        location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
                proxy_pass http://185.207.231.127:7080;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header X-Accel-Internal /internal-nginx-static-location;
                access_log off;

        }

        add_header X-Powered-By PleskLin;

}
# configuration file /etc/nginx/plesk.conf.d/vhosts/shopware6.develop-nordic.de.conf:
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

server {
        listen 185.207.231.127:443 ssl http2;

        server_name shopware6.develop-nordic.de;
        server_name www.shopware6.develop-nordic.de;
        server_name ipv4.shopware6.develop-nordic.de;

        ssl_certificate             /usr/local/psa/var/certificates/scfwMAJ27;
        ssl_certificate_key         /usr/local/psa/var/certificates/scfwMAJ27;

        error_page 400 "/error_docs/bad_request.html";
        error_page 401 "/error_docs/unauthorized.html";
        error_page 403 "/error_docs/forbidden.html";
        error_page 404 "/error_docs/not_found.html";
        error_page 500 "/error_docs/internal_server_error.html";
        error_page 405 "/error_docs/method_not_allowed.html";
        error_page 406 "/error_docs/not_acceptable.html";
        error_page 407 "/error_docs/proxy_authentication_required.html";
        error_page 412 "/error_docs/precondition_failed.html";
        error_page 414 "/error_docs/request_uri_too_long.html";
        error_page 415 "/error_docs/unsupported_media_type.html";
        error_page 501 "/error_docs/not_implemented.html";
        error_page 502 "/error_docs/bad_gateway.html";
        error_page 503 "/error_docs/maintenance.html";

        location ^~ /error_docs {
                root "/var/www/vhosts/develop-nordic.de";
        }

        client_max_body_size 134217728;

        access_log "/var/www/vhosts/system/shopware6.develop-nordic.de/logs/proxy_access_ssl_log";
        error_log "/var/www/vhosts/system/shopware6.develop-nordic.de/logs/proxy_error_log";

        root "/var/www/vhosts/develop-nordic.de/httpdocs/projects/shopware6/public";

        #extension letsencrypt begin
        location ^~ /.well-known/acme-challenge/ {
                root /var/www/vhosts/default/htdocs;

                types { }
                default_type text/plain;

                satisfy any;
                auth_basic off;
                allow all;

                location ~ ^/\.well-known/acme-challenge.*/\. {
                        deny all;
                }
        }
        #extension letsencrypt end

        #extension sslit begin

        #extension sslit end

        location / {
                proxy_pass https://185.207.231.127:7081;
                proxy_hide_header upgrade;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header X-Accel-Internal /internal-nginx-static-location;
                access_log off;

        }

        location /internal-nginx-static-location/ {
                alias /var/www/vhosts/develop-nordic.de/httpdocs/projects/shopware6/public/;
                internal;
        }

        location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
                proxy_pass https://185.207.231.127:7081;
                proxy_hide_header upgrade;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header X-Accel-Internal /internal-nginx-static-location;
                access_log off;

        }

        location ~ ^/~(.+?)(/.*?\.php)(/.*)?$ {
                alias /var/www/vhosts/develop-nordic.de/web_users/$1/$2;
                fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
                try_files $uri $fastcgi_script_name =404;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_pass "unix:/var/www/vhosts/system/shopware6.develop-nordic.de/php-fpm.sock";
                include /etc/nginx/fastcgi.conf;

        }

        location ~ ^/~(.+?)(/.*)?$ {
                proxy_pass https://185.207.231.127:7081;
                proxy_hide_header upgrade;
                proxy_set_header Host             $host;
                proxy_set_header X-Real-IP        $remote_addr;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                proxy_set_header X-Accel-Internal /internal-nginx-static-location;
                access_log off;

        }

        location ~ \.php(/.*)?$ {
                fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
                try_files $uri $fastcgi_script_name =404;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_pass "unix:/var/www/vhosts/system/shopware6.develop-nordic.de/php-fpm.sock";
                include /etc/nginx/fastcgi.conf;

        }

        add_header X-Powered-By PleskLin;

        include "/var/www/vhosts/system/shopware6.develop-nordic.de/conf/vhost_nginx.conf";
}

server {
        listen 185.207.231.127:80;

        server_name shopware6.develop-nordic.de;
        server_name www.shopware6.develop-nordic.de;
        server_name ipv4.shopware6.develop-nordic.de;

        error_page 400 "/error_docs/bad_request.html";
        error_page 401 "/error_docs/unauthorized.html";
        error_page 403 "/error_docs/forbidden.html";
        error_page 404 "/error_docs/not_found.html";
        error_page 500 "/error_docs/internal_server_error.html";
        error_page 405 "/error_docs/method_not_allowed.html";
        error_page 406 "/error_docs/not_acceptable.html";
        error_page 407 "/error_docs/proxy_authentication_required.html";
        error_page 412 "/error_docs/precondition_failed.html";
        error_page 414 "/error_docs/request_uri_too_long.html";
        error_page 415 "/error_docs/unsupported_media_type.html";
        error_page 501 "/error_docs/not_implemented.html";
        error_page 502 "/error_docs/bad_gateway.html";
        error_page 503 "/error_docs/maintenance.html";

        location ^~ /error_docs {
                root "/var/www/vhosts/develop-nordic.de";
        }

        client_max_body_size 134217728;

        access_log "/var/www/vhosts/system/shopware6.develop-nordic.de/logs/proxy_access_log";
        error_log "/var/www/vhosts/system/shopware6.develop-nordic.de/logs/proxy_error_log";

        location / {
                return 301 https://$host$request_uri;
        }
}

# configuration file /etc/nginx/plesk.conf.d/vhosts/test.develop-nordic.de.conf:
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

server {
        listen 185.207.231.127:443 ssl http2;

        server_name test.develop-nordic.de;
        server_name www.test.develop-nordic.de;
        server_name ipv4.test.develop-nordic.de;


        error_page 400 "/error_docs/bad_request.html";
        error_page 401 "/error_docs/unauthorized.html";
        error_page 403 "/error_docs/forbidden.html";
        error_page 404 "/error_docs/not_found.html";
        error_page 500 "/error_docs/internal_server_error.html";
        error_page 405 "/error_docs/method_not_allowed.html";
        error_page 406 "/error_docs/not_acceptable.html";
        error_page 407 "/error_docs/proxy_authentication_required.html";
        error_page 412 "/error_docs/precondition_failed.html";
        error_page 414 "/error_docs/request_uri_too_long.html";
        error_page 415 "/error_docs/unsupported_media_type.html";
        error_page 501 "/error_docs/not_implemented.html";
        error_page 502 "/error_docs/bad_gateway.html";
        error_page 503 "/error_docs/maintenance.html";

        location ^~ /error_docs {
                root "/var/www/vhosts/develop-nordic.de";
        }

        client_max_body_size 134217728;

        access_log "/var/www/vhosts/system/test.develop-nordic.de/logs/proxy_access_ssl_log";
        error_log "/var/www/vhosts/system/test.develop-nordic.de/logs/proxy_error_log";

        root "/var/www/vhosts/develop-nordic.de/test.develop-nordic.de";

        #extension letsencrypt begin
        location ^~ /.well-known/acme-challenge/ {
                root /var/www/vhosts/default/htdocs;

                types { }
                default_type text/plain;

                satisfy any;
                auth_basic off;
                allow all;

                location ~ ^/\.well-known/acme-challenge.*/\. {
                        deny all;
                }
        }
        #extension letsencrypt end

        #extension sslit begin

        #extension sslit end

        location ~ /\.ht {
                deny all;
        }

        location ~ ^/(plesk-stat|awstats-icon|webstat|webstat-ssl|ftpstat|anon_ftpstat) {
                auth_basic "Domainstatistiken";
                auth_basic_user_file "/var/www/vhosts/system/test.develop-nordic.de/pd/d..httpdocs@plesk-stat";
                autoindex on;

                location ~ ^/plesk-stat(.*) {
                        alias /var/www/vhosts/system/test.develop-nordic.de/statistics/$1;
                }

                location ~ ^/awstats-icon(.*) {
                        alias /usr/share/awstats/wwwroot/icon/$1;
                }

                location ~ ^/(.*) {
                        alias /var/www/vhosts/system/test.develop-nordic.de/statistics/$1;
                }
        }

        location ~ ^/~(.+?)(/.*?\.php)(/.*)?$ {
                alias /var/www/vhosts/develop-nordic.de/web_users/$1/$2;
                fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
                try_files $uri $fastcgi_script_name =404;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_pass "unix:/var/www/vhosts/system/test.develop-nordic.de/php-fpm.sock";
                include /etc/nginx/fastcgi.conf;

        }

        location ~ \.php(/.*)?$ {
                fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
                try_files $uri $fastcgi_script_name =404;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_pass "unix:/var/www/vhosts/system/test.develop-nordic.de/php-fpm.sock";
                include /etc/nginx/fastcgi.conf;

        }

        index "index.html" "index.cgi" "index.pl" "index.php" "index.xhtml" "index.htm" "index.shtml";

        add_header X-Powered-By PleskLin;

        include "/var/www/vhosts/system/test.develop-nordic.de/conf/vhost_nginx.conf";
}

server {
        listen 185.207.231.127:80;

        server_name test.develop-nordic.de;
        server_name www.test.develop-nordic.de;
        server_name ipv4.test.develop-nordic.de;

        error_page 400 "/error_docs/bad_request.html";
        error_page 401 "/error_docs/unauthorized.html";
        error_page 403 "/error_docs/forbidden.html";
        error_page 404 "/error_docs/not_found.html";
        error_page 500 "/error_docs/internal_server_error.html";
        error_page 405 "/error_docs/method_not_allowed.html";
        error_page 406 "/error_docs/not_acceptable.html";
        error_page 407 "/error_docs/proxy_authentication_required.html";
        error_page 412 "/error_docs/precondition_failed.html";
        error_page 414 "/error_docs/request_uri_too_long.html";
        error_page 415 "/error_docs/unsupported_media_type.html";
        error_page 501 "/error_docs/not_implemented.html";
        error_page 502 "/error_docs/bad_gateway.html";
        error_page 503 "/error_docs/maintenance.html";

        location ^~ /error_docs {
                root "/var/www/vhosts/develop-nordic.de";
        }

        client_max_body_size 134217728;

        access_log "/var/www/vhosts/system/test.develop-nordic.de/logs/proxy_access_log";
        error_log "/var/www/vhosts/system/test.develop-nordic.de/logs/proxy_error_log";

        location / {
                return 301 https://$host$request_uri;
        }
}
# configuration file /var/www/vhosts/system/test.develop-nordic.de/conf/vhost_nginx.conf:
location  /{
        proxy_redirect off;
        proxy_set_header X-forwarded-by $remote_addr;
        proxy_set_header X-forwarded-host test.develop-nordic.de;
        proxy_set_header X-forwarded-for $remote_addr;
        proxy_pass https://test.plattenzuschnitt24.de;
}

ตัวเลือกนึงที่ทำได้คือการใช้ Reverse Proxy ช่วยครับ

เช่น เราตั้ง Nginx ให้เป็น reverse proxy โดยทำหน้าที pass through connection โดยอาจจะเปลี่ยนค่าจาก subdomain ให้เป็น url path เมื่อส่งไปให้ backend / web server ทำงานครับ เช่น

user1.domain-x.com/foo จะแปลง request ไปให้ server เป็น domain-x.com/user1/foo
user2.domain-x.com/bar จะแปลง request ไปให้ server เป็น domain-x.com/user2/bar

ทั้งนี้เราสามารถออกแบบได้ว่าจะเอา part ที่เป็น subdomain ไปอยู่ในรูปแบบของ path / query string parameter หรือ http header ตามที่เราต้องการได้ครับ

Keyword ที่เอาไปศึกษาต่อได้ น่าจะเป็น multi-tenant with subdomain ครับ อาจจะพบกับทางเลือกอื่นๆในการจัดการกับ customer identity ครับ