Question:
Subdomains with no-ip?
anonymous
2014-04-06 06:44:57 UTC
Hello
I have a dedicated server running in my home, I have a domain and no-ip is managing the DNS side of things. I need to set up some subdomains, eg panel.domain.com, I have set this up in no-ip to point to my IP but it just points to the apache home directory. The same as domain.com would.
So how can I set up subdomains with apache. I dont want to have to setup nameservers as that is what no-ip is doing for me.
Sorry for bad explanation, cant reallly do any better.
Thanks.
Three answers:
efflandt
2014-04-06 11:36:17 UTC
You need to read apache docs about name based virtual hosts. Then the same apache on one 1 IP can serve up different content based on what hostname is in the "Host:" header of the http request from the web browser. http://httpd.apache.org/docs/2.4/vhosts/



Or expanding on that, instead of serving local content in a different directory, a name based virtual host could proxy content from a different server (or webcam) on your LAN by using mod_proxy module and ProxyPass directive.



In those cases it is usually best to set "UseCanonicalName off", so any automatic redirections due to incomplete URLs are redirected using the hostname in the Host: header instead of whatever is set or assumed for ServerName of the main server (which might be something that does not resolve to a public IP address). Since these are name (not IP) base virtual hosts and your public IP may not be on your server itself, the virtual host sections should use a wildcard for IP at the beginning of the virtual host sections:



or IP:port if different than port 80



I worked that all out many years ago when Windows IIS worms kept filling my logs. And I figured out how to have any http request with no Host: header, or that did not match one of my multiple no-ip.com names, go to a dead end 1 page site with separate logging. If the Host: matched a name it would serve specific content for that name. But that was in rather old SuSE 8.2 Linux from over 10 year ago (still running on an old Celeron 333 Mhz PC). So I am not sure which files more recent apache puts those directives into.
Robert J
2014-04-06 11:36:52 UTC
If it can work at all, you need to configure Apache for virtual host mode.



That will give each different site it's own web-root directory so they can have independent content.

It's the method normal web hosts use to have multiple users web sites on each of their servers.



As long as the original domain name is passed through to the web server, it can automatically distinguish between the various sites.



See the links below for details:



http://httpd.apache.org/docs/2.2/vhosts/

http://www.thegeekstuff.com/2011/07/apache-virtual-host/

http://httpd.apache.org/docs/current/vhosts/examples.html
Marsh
2014-04-06 06:46:18 UTC
I really don't understand what you mean, but if you mean your subdomains do not have the same IP then yes, that is very likely possible.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...