You are here
I just installed a new turnkey LAMP server, and everything seems to be working great. However the Control Panel page comes up whenever I try to browse to my domain, no matter what I do.
I moved the contents to the /var/www folder (containing the Turnkey LAMP Control Panel) into subfolder (lets call it admin.mysite,com) and I dumped my website into the /var/www/www.mysite,com folder, and setup the Apache virtual hosts for each. I also placed a simle index.html file in /var/www for testing purposes. I the directory looks like this:
/var/www/admin.mysite,com /var/www/www.mysite,com /var/www/index.html
Apache is set for www.mysite,com to respond to any address on any port. admin.mysite,com is ony supposed to respond to admin.mysite,com on any port.
Here are the conf files generated my webmin
<VirtualHost *> DocumentRoot /var/www/www.mysite,com <Directory "/var/www/www.mysite,com"> allow from all Options +Indexes </Directory> </VirtualHost>
<VirtualHost admin.mysite,com:*> DocumentRoot /var/www/admin.mysite,com </VirtualHost>
I am most likely missing something really basic here, but no matter how I set it up, the Control Panel always shows up when I go to www.mysite,com, even when I tell the admin.mysite,com to only listen to a specific port. The only way I have been able to access anything other then the control panel is to remove the files compleatly.
In short; I would like to serve out my own website, with the Control Panel only accessable via a sub domain. How can I accomplish this?
BTW, I had to replace the . in the urls with a , to get around the spam filter. I guess it thought I was posting links or something. Sorry if it looks weird.
Did you restart/reload Apache?
For Apache to use an updated config (e.g. like adjusting virtual hosts) you need to at least reload Apache.
or
I guess I should have
Have you disabled the default site?
Also it may be worth clearing your browser cache too
I'll have a quick look and post what I find...
Ok...
Personally if I were only planning on running one site (and didn't actually need to use a subdomain) then I would leave the config default and just dump the new site straight into /var/www. If you wanted to keep the TurnKey control panel, either rename it turnkey.html (and access it with http://mysite.com/turnkey.html) or move it to a directory like /var/www/admin (and access it with http://mysite.com/admin).
Also keep in mind that if you want to use subdomains then you'll need to have the DNS setup properly...
Also I haven't ever used the Webmin Apache module so I can't really talk to that... Glancing at it it seemed confusing to me and using the manual config way isn't too hard IMO. So without knowing exactly what Webmin Apache has done, this is what I did from a clean install of TKL LAMP
As a little background; I made the name resolution work by adding entries of admin.server and www.server to my local hosts file (pointing to the IP of my VM). I moved the contents of the /var/www directory (except for cgi) into /var/www/admin.server and created a new directory /var/www/www.server with a very basic index.html file inside so I could be sure it was working... I then copied the contents of /etc/apache2/sites-available/default to 2 new 'sites' (in that same folder) admin.server and www.server
In /etc/apache2/sites-available/admin.server I have:
And in /etc/apache2/sites-available/www.server I have:
I then disabled the default site, and enabled my 2 new sites:
Then reload Apache:
Apache complained:
But testing confirmed that it worked... To resolve the warning just remove the first 2 lines from www.server. The virtual hosts have already been declared in admin.server and the 'sites' files are processed sequentially in alphanumeric order i.e. '0' comes before '1' and both come before 'a' (which comes before 'z' etc...)
The reason why I left them there is so that each file can be enabled/disabled individually, without breaking the other. E.g. to disable the 'admin' site but leaving the 'www' site active you would do:
I guess another way to go would be to make a separate site (in /etc/apache2/sites-available) with just the first 2 lines (and remove the matching lines from both of the existing sites). If you go that way, then I would suggest the new site (declaring the NameVirtualHost directives) starts with '00' (e.g. '00base') so that it is processed by Apache first (prior to the other sites that will rely on it).
Add new comment