I used the CNAME wild card DNS entry like:
@ IN A ip.add.re.ss
www IN CNAME @
* IN CNAME @
My root domain.com and sub1.domain.com are accessible (on the same digitalocean droplet).
But if I try to access sub2.domain.com, after web server configuration, it takes me to sub1.domain.com.
I'm using NginX server blocks and all domains are using the same IP address. (I've configured domain.com on 80 while I access/configure subs like sub1.domain.com:8088 and sub2.domain.com:8088)
sub1 is phpmyadmin:
server {
listen 8088;
server_name phpmyadmin.mydomain.com;
root /usr/share/nginx/html/phpmyadmin;
index index.php index.html index.htm;
access_log /var/log/nginx/phpmyadmin/access.log;
error_log /var/log/nginx/phpmyadmin/error.log;
if (!-e $request_filename) {
rewrite ^/(.+)$ /index.php?url=$1 last;
break;
}
# Images and static content is treated different
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
expires 360d;
}
location ~ /\.ht {
deny all;
}
location ~ /(libraries|setup/frames|setup/libs) {
deny all;
return 404;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
sub2 is stats:
server {
listen 8088;
server_name stats.mydomain.com;
root /usr/share/nginx/html/piwik;
index index.php piwik.php;
access_log /var/log/nginx/piwik/access.log;
error_log /var/log/nginx/piwik/error.log;
location ~ /\.ht {
deny all;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
My /etc/hosts:
127.0.0.1 localhost mydomain
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Hitting in the browser phpmyadmin.mydomain.com:8088 works fine but hitting stats.mydomain.com:8088 takes me to phpmyadmin login page. Do I need to create more A or CNAME records for more than one subdomains?
No comments:
Post a Comment