Tags:

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

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

No Description

Get latest news from Blognone
By: BlackMiracle
WriterAndroidUbuntuWindows
on 31 July 2022 - 17:58 #1256719

ไม่ค่อยเข้าใจคำถามเลยครับ ปกติเราทำเว็บมาก็ต้องจดโดเมนตามที่เราอยากได้อยู่แล้ว แต่อยากให้ user custom domain ได้คือยังไงครับ


Pitawat's Blog :: บล็อกผมเองครับ

By: pepporony
ContributorAndroid
on 31 July 2022 - 18:19 #1256723 Reply to:1256719

เหมือนพวก blog หรือเปล่าครับ ที่พอสมัคร user นั้นๆก็จะได้ url user.myblog.com ไรงี้

By: Anonymous on 1 August 2022 - 00:43 #1256763 Reply to:1256719
Anonymous's picture

ใส่ตัวอย่างของ wix ให้แล้วครับ

By: big50000
AndroidSUSEUbuntu
on 31 July 2022 - 18:45 #1256725
big50000's picture

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

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

By: Anonymous on 1 August 2022 - 00:46 #1256764 Reply to:1256725
Anonymous's picture

ขอบคุณครับ ที่สร้างไว้ตอนนี้จะเน้นสร้าง portfolio ครับ

By: lancaster
Contributor
on 1 August 2022 - 01:52 #1256769

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 นั้นครับ
By: Anonymous on 24 October 2022 - 05:20 #1266307 Reply to:1256769
Anonymous's picture

ขอบคุณครับ

By: rattananen
AndroidWindows
on 2 August 2022 - 15:56 #1256825

คุณต้องเขียนโปรแกรมสำหรับ 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;
}
By: Anonymous on 24 October 2022 - 05:20 #1266308 Reply to:1256825
Anonymous's picture

ขอบคุณครับผม

By: ZiiT
ContributorAndroidWindows
on 3 August 2022 - 21:47 #1257207

ตัวเลือกนึงที่ทำได้คือการใช้ 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 ครับ

By: Anonymous on 24 October 2022 - 05:21 #1266309 Reply to:1257207
Anonymous's picture

ขอบคุณครับ ช่วยให้เห็นภาพมากขึ้น