Score:0

using virtual subdomains on nginx on localhost laragon server to be dynamic

tn flag

i have this config file domain.beta.conf

server {
    listen 80;
    listen 443 ssl;
    server_name ~^(www\.)?(?<version>(.+\.))?domain.beta$ domain.beta
    root "X:/xx/www/domain"

    location / {
        try_files $uri $uri/ =404;
        autoindex on;
        rewrite ^/([^/]+)/?$ /$1.php last;
    }
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass php_upstream;      
        #fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

}

what i expect is these domains to work

domain.beta
www.domain.beta

v1.domain.beta
v2.domain.beta
...
www.v1.domain.beta
www.v2.domain.beta
...

but what works is only domain.beta and if i try anything else i get

www.domain.beta’s server IP address could not be found
v1.domain.beta’s server IP address could not be found
www.v1.domain.beta’s server IP address could not be found

my nginx.conf is

worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    keepalive_timeout  32;
    proxy_connect_timeout  16000;
    proxy_send_timeout  16000;
    proxy_read_timeout  16000;
    send_timeout  16000;
    include "X:/xx/sites/nginx/sites-enabled/*.conf";
    client_max_body_size 1000M;
    server_names_hash_bucket_size 32;
}

but i also want catch on it from php side as $_GET['version'] but i could not reach that yet because stuck here

i just want it to work exactly as if it was rewrite like domain.beta/v1/ but that does not help that www. does not work too

i have no background knowledge about manging servers except to rewrite urls

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.