So I have a domain name let's say example.com, so is it possible to find all the sub-domains like a.example.com, b.example.com, etc.?
You can use command like:
dig example.com ALL
or
host -l example.com
But be aware you will get result only if machine where you run this have permission to do zone transfers for this domain. Otherwise you will see nothing.
Related
So I have a domain(example.com), where I want the root url
example.com
to direct to my landing page's DNS that comes from its hosting provider and I want every other url
example.com/whatever-here
to direct to my main hosting provider, which is digital ocean with its DNS. I did it before, but with subdomains. The example.com part was directing to my landings and their hosts, while everything that started with the "app" subdomain (app.example.com) directed users to my main hosting. Now I want to do it without introduction of subdomains. Is it done somewhere on Nginx level? Or is it configured in my hosting providers' settings? Couldn't find the answer so far.
You can't.
The hostname indicates what server your browser is going to connect to. The requested path is then sent to that server, only after the browser has connected to it.
Just as #Brad said, it's impossible to directly host a domain name on two different DNS'es simultaneously. However, I managed to find two approaches that don't do what I wanted, but the end result is pretty much the same:
Host www.domain.com on one server and domain.com on another. Not all providers support it, so it's a not guaranteed-to-work solution. But it's still a solution.
Use Nginx's proxy-pass without redirect or a similar function of your webserver.
This way, you can have example.com actually load some-other-site.com without changing the browser url. I'll provide my Nginx configuration for reference:
location = / {
include proxy_params;
proxy_pass http://other-domain-or-ip.com/;
}
This is just the result I wanted and it makes me think that I fell victim to the X->Y problem here.
is there a unix command to retrieve all informations possible from a website?
I mean info like: IP, IP geo location, (sub-)domains, alternative domain names, name server, and all other informations I'm thinking about.
I know about whois, but is there anything else?
Something that gives more informations?
Thanks
I don't know any command that can do all of that at once but a simple pipeline should work too.
ping www.website.com for IP
curl ipinfo.io/ip-adress for geo-location
nslookup -query=soa www.website.com for original DNS
Alternatively you can use the command dig to find the subdomains via the DNS:
dig domain.com the output in the authority section are the DNS servers which are used
dig #dns.server domain.com AFXR to retrieve the subdomains of domain.com
On my Nginx I've got two hosts.
One with the values
server_name = www.mydomain.com;
root /var/www/production/myFirstWebSite;
and the other with
server_name=localhost;
root /var/www/development/mySecondWebSite;
To my domain registrar account I configured the DNS with two A record "
www IN A myIP
IN A myIP
This is cool, i can reach my first website with www.mydomain.com or mydomain.com.
Now the problem is how to reach my second website which is in development and I don't buy the domain name. And myIP/development/myScondWebSite is no more working ...
I think that the problem come from the DNS entries but I'm not sure.
Do you've got some ideas ?
Thanks in advance.
There's a couple of ways I could think of to access the localhost one.
Creating a subdomain instead of localhost
This is the best one I'd recommend, try doing something like server_name localhost.mydomain.com.
If you need to put further security, you could make it only allow a certain IP(s) or a range of IPs.
Play with your hosts file
In this specific case I would not recommend this, because you're messing with localhost it self, might break some other stuff on your machine, if it was any other name I could have said it's fine.
Use an ssh tunnel to the server
In this method you create a dynamic port on your ssh connection and set your browser to pass all traffic through tunnel which goes to the server then it's handled from there, so if you run localhost for example it would be like running localhost from over there, but since this involved a browser setting, you need to remember to disable it after you disconnect the ssh connection otherwise the browser would return an error saying that the proxy server is refusing the connection.
Using a local Nginx as a proxy
This one I just came up with right now, and I can't say If it would work or not, the 3 before I've worked with before and I know they work.
You'd set a certain domain name that your local nginx would capture and then proxy it to the remote server, but edit the host header setting it to localhost instead, that way it would match the localhost in the remote machine, if this one works it would not need any setting to be turned on and off every time.
Out of all these, I'd recommend the first one first (if it's an option), then try the last one if you don't want to keep turning things on and off before and after each setting.
Ok, I have no good way of trying to logically say this.. so I will try my best to describe it but apologize in advance for doing a poor job.
I have 6 or so sub domains, and recently had a SSL cert installed on my server. All my inbound traffic if using https seems to be going through the main domain, rather than any of the 6 subdomains.
so I have for example:
domain.com - main domain
sub1.domain.com
sub2.domain.com
sub3.domain.com
sub4.domain.com
sub5.domain.com
sub6.domain.com
if I use https://subX.domain.com (X being a number from above). The files in the subX are not used. I tested this concept by putting a couple seed files in each variation of the domain. All unique and random. So theres no way any one of the domains could have those files.
using any of the 6 subs I get 404's.. however if I use either domain.com or subX.domain.com and a file thats only in domain.com example: domain.com has iiiindext25.html but none of the subs do..
If I do https://subX.domain.com/iiiindext25.html I see that file, if I do http://subX.domain.com/iiiindext25.html I don't see that file, I see the 404 error I would expect.
if I do http://subX.domain.com/ any of the files I put in any one respectively I see the file.
So overall It appears anytime https:// is in play all traffic gets routed to the main domain. Which I don't picture being proper behavior. Any suggestions or ideas of what could be wrong?
The situation now, the https is listening on the root folder, I'm not fully familiar with Apache but all web servers think the same. Can you try to check the /etc/httpd/conf.d/ssl.conf You will see which folder is asigned by default.
Now you can edit your Virtual host and add
<VirtualHost *:443>
ServerName subX.example.com
DocumentRoot /yoursite/www
SSLEngine on
SSLCertificateFile /etc/ssl/private/subX.example.com.pem
</VirtualHost>
but remember if the certificate is not wildcard you will get the The site's security certificate is not trusted!
And restart the apache after changing in the Virtual host
I have a website sitting on an IIS 7 server:
WWW.example.COM
I would like to create several sub domains that looks like
SUBDOMAIN1.example.COM
I created an IIS website and I set the bindings to be
http, port 80, the ip address of my server, and SUBDOMAIN1.example.COM and the physical path to a folder under example.COM
I restarted my website and clicked on browse, the browser than opened with the address:
http://SUBDOMAIN1.example.COM
But the website doesn't show up.
Do I have to do something with the DNS?
This one drove me crazy... basically you need two things:
1) Make sure your DNS is setup to point to your subdomain. This means to make sure you have an A Record in the DNS for your subdomain and point to the same IP.
2) You must add an additional website in IIS 7 named subdomain.example.com
Sites > Add Website
Site Name: subdomain.example.com
Physical Path: select the subdomain directory
Binding: same ip as example.com
Host name: subdomain.example.com
Wildcard method: Add the following entry into your DNS server and change the domain and IP address accordingly.
*.example.com IN A 1.2.3.4
http://www.webmasterworld.com/microsoft_asp_net/3194877.htm
If your computer can't find the IP address associated with SUBDOMAIN1.example.COM, it will not find the site.
You need to either change your hosts file (so you can at least test things - this will be a local change, only available to yourself), or update DNS so the name will resolve correctly (so the rest of the world can see it).
As DotNetMensch said but you DO NOT need to add another site in IIS as this can also cause further problems and make things more complicated because you then have a website within a website so the file paths, masterpage paths and web.config paths may need changing. You just need to edit teh bindings of the existing site and add the new subdomain there.
So:
Add sub-domain to DNS records. My host (RackSpace) uses a web portal to do this so you just log in and go to Network->Domains(DNS)->Actions->Create Zone, and enter your subdomain as mysubdomain.domain.com etc, leave the other settings as default
Go to your domain in IIS, right-click->Edit Bindings->Add, and add your new subdomain leaving everything else the same e.g. mysubdomain.domain.com
You may need to wait 5-10 mins for the DNS records to update but that's all you need.