[Solved] Subdomains? A how-to for idiots request.
Most of Linode's documentation seems to simply not apply to me, because I have the touch of death. I've spent today trying to set up a simple sub domain with nothing but failure. (I've even managed to create lingering symlinks that I don't know how to remove. But I don't care about that right now lol)
I don't want to even attempt to use ISPconfig, because the last time I tried it wrecked apache2.
So, put simply, blah.mydomain.com, pointing to a specific folder. (Domain.com/wahhimdumb).
Any and all help would be appreciated.
Thanks, folks!
Dave
16 Replies
All domains and subdomains point to your VPS public IP (setup in where ever you're managing your DNS records).
Then setup VHOSTS for all subdomains in whatever web engine you're using.
Remember to restart your web engine after making config file changes.
Test (ping each subdomain - they all should show the same public IP - if not check DNS - browse to each subdomain, they should show whatever you put in each VHOST).
I usually put a simple test page in each VHOST to make testing a bit easier
<title>Test Page</title>
## It's Alive!
It tells where you went (so verifies the VHOST setup) and tells what IP you're visting from (so verifies that PHP is working). It's nothing fancy, but it's a quick check that your basic's are working.
If it takes too much time for the dns to propagate or to figure that portion out.. you can cheat in the /etc/hosts on your local computer…and your node..
I do that occasionally to test before I leap.
One of the reasons for coming to linode was to learn. But so far I've learned I'm learning disabled lol
The suggested web site while informative doesn't really do what I'm looking for. At least I don't think it does.
I have no idea where to go, really. (Yea, Apache2 on Ubuntu 12)
I'm not trying to run two domains into one IP or anything.
I just want blah.domain.com to load domain.com/folder instead of domain.com.
According to linodes documentationlols I had to set up a new A name for my current domain called (in this example) "blah"
After that, I don't know what to do. From the way it looked via documentation I had to run the whole apache setup process over again, while trying to assume how to substitute something for the sub domain. The documentation is beyond terrible for new to linux VPS guys in many areas. I don't have enough super highway smarts to look both ways, I guess lol. It's still better than walking without shoes.
I know this can't be so complicated. There's something I need to put somewhere. I don't know what it is or where it goes.
Could it be something insanely simple as adding something to the apache 2 config?
> I'm not trying to run two domains into one IP or anything.
I just want blah.domain.com to load domain.com/folder instead of domain.com.
you really are… trying to run two named based virtual hosts….
blah.domain.com and domain.com
sooo… there is at least one config file that needs changing/fixin… and that most likely is in /etc/apache2/sites-available. I would drop a nickel in the pot to say that most likely that file is sym-linked in /etc/apache2/sites-enabled ….
Of course your mileage may vary… but apache has some very good docs…
If we had the domain name(s) you were bringing up we might could help troubleshoot a little better
Most everyone here was new at one time or another… to all this stuff… so don't be so hard on yourself.
First things first… do you have the two names in DNS correctly so blah.domain.com and domain.com at least are served the same page from 'your vps'? Again we need the domain name and the blah<.>somain name…(right now requesting the ip prolly shows the same thing….) be nice if we had that… as well…
Apache's manual is really good as manuals go… it is huge.
Yea, hard on myself is a life time habit lol
nonetforyou.com , with the I'm sure not difficult to find IP 23.239.26.130.
Basically, I would be creating minecraft.nonetforyou.com to point to 23.239.26.130(nonet)/minecraft
Once I get all these basics down, (if lol) I can start un 1990'sing things and get back to remembering how to internet.
(Was on host gator, until I realized just how limited I was. Figured might be an adventure to consolidate all the nerdisms. I wasn't wrong.)
Currently, it's about time for me to surrender the night so I can look alive at work tomorrow.
I'll give the pages a once over again when time allows after work.
I really truly appreciate you being here to help me though. Thank you!
Do you have a separate vhost file for minecraft.nonetforyou.com? If you do you point the document root to the nonetforyou.com/minecraft folder and you're good to go.
MSJ
I don't know wll the tweaks needed for minecraft… but what Main street James said… is right. A vhosts file(with the right stuff in it) in /etc/apache2/sites-available symlinked in /etc/apcahe2/sites-enabled. and then apache2ctl restart should get you up an runnin.
whattaya mean work? this is far more important
I have minecraft.nonetforyou.com.conf in the sites-available directory, which I did link to sites-enabled with sudo a2ensite minecraft.nonetforyou.com.conf (from the appropriate user, and not root)
But I still do not get my desired results.
I'm sure I'm not doing this right lol
This be the contents, (I did change the alias a couple times minecraft.no to just no.)
ServerAdmin
ServerName
ServerAlias minecraft.nonetforyou.com
Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/methlon/public/nonetforyou.com/public/minecraft
Log file locations
LogLevel warn
ErrorLog /home/methlon/public/nonetforyou.com/log/error.log
CustomLog /home/methlon/public/nonetforyou.com/log/access.log combined
And yes, while I do consider this more important, the guys with whom are responsible for my affording this stuff tend to disagree lol
Thanks again!
Dave
(edited: I'm all tired and didn't double check the directors I wrottered in.)
Do you have any other conf files linked in there? might be good to see those…
I don't think aliases work this way… they will serve the same content as the servername (iirc)
I haven't used them in a long time.
<virtualhost *:80=""># Admin email, Server Name (domain name), and any aliases
ServerAdmin admin@nonetforyou.com
ServerName www.nonetforyou.com
ServerAlias minecraft.nonetforyou.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/methlon/public/nonetforyou.com/public/minecraft
# Log file locations
LogLevel warn
ErrorLog /home/methlon/public/nonetforyou.com/log/error.log
CustomLog /home/methlon/public/nonetforyou.com/log/access.log combined</virtualhost>
To be sure I'd like to see the other conf file… for default… but I suspect that you could make this conf look like this:
<virtualhost *:80=""># Admin email, Server Name (domain name), and any aliases
ServerAdmin admin@nonetforyou.com
ServerName minecraft.nonetforyou.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/methlon/public/nonetforyou.com/public/minecraft
# Log file locations
LogLevel warn
ErrorLog /home/methlon/public/nonetforyou.com/log/error.log
CustomLog /home/methlon/public/nonetforyou.com/log/access.log combined</virtualhost>
I am not certain but I think that would work…we could probably tell for sure if we saw all the configs.
But yea, the default nonetforyou.com.conf is pretty much the same thing.
> # domain: example.com
public: /home/methlon/public/nonetforyou.com/
# Admin email, Server Name (domain name), and any aliases ServerAdmin
admin@nonetforyou.com ServerName
http://www.nonetforyou.com ServerAlias nonetforyou.com
Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /home/methlon/public/nonetforyou.com/public
Log file locations
LogLevel warn
ErrorLog /home/methlon/public/nonetforyou.com/log/error.log
CustomLog /home/methlon/public/nonetforyou.com/log/access.log combined
Haven't really thought about the logs yet… but yea, I can and should change that soon lol
The directives available for directory access and so forth are straightforward.
The recommendation I had earlier… needs much work.. for apache to work properly… now that I See what is in your other vhost file…. I respectfully withdraw that snipppet.. and remind you it is not complete by any means.
Good luck. Read up on the manual and put everything back to default until you understand what it is you need to do. then test it… then put your gaming server up for everyone to enjoy.
IMHO.
I appreciate what you've done for me, though.
I'll see if I can figure out what it is I need to be doing.
Thanks for your time.
ServerName
you can leave the ServerAlias alone
in minecraft.nonetforyou.com.conf, change ServerName to minecraft.nonetforyou.com and remove ServerAlias
ServerName minecraft.nonetforyou.com
( looked up and I'm not sure how the HTTP's ended up in what I've added, unless the forum adds it by default )
Tomorra' will be (if nothing blows up around the house) learn things day
Hopefully I can figure out what I'm not doing right.
Turns out I was doing things well enough, but I had some config problems in apache2. Things that I'd removed, but didn't remove enough of from apache, causing it to fail to restart properly.
Also this works.
Now future noobs know how to subdomain lol
>
ServerAdmin
admin@nonetforyou.com DocumentRoot /home/methlon/public/nonetforyou.com/public/minecraft
Options FollowSymLinks AllowOverride None
Options Indexes FollowSymLinks MultiViews AllowOverride All
Order allow,deny
allow from all
LogLevel warn
ErrorLog /blah
CustomLog /blah
All better now.
Thanks for everything, guys!
So far so good.
Here you go internet.
Redirect permanent fixes it so that everything not defined as a sub domain takes you to (In this case) your root.
So use that, and substitute the rest (while doing the sites-available a2ensite stuff) and defining your A name.
Shud werk.
This is what the httpd.conf thingey will sorta look like.
> ServerName localhost
ServerName sub.domain.lol DocumentRoot /home/herp/derp/
ServerName http://www.domain.com ServerAlias *.domain.com
Redirect permanent /
http://domain.com