clintdoriot's picture

Hello,

I'm trying to use Turnkey LAMP VM to create my web development environment. I've set up the VM, and created the virtual host, but when I go to the page on my host machine, it won't load.

I know similar questions have been asked before, but I've tried those steps and it doesn't seem to be working.

Here's the steps I've taken:

  1. Created new user name for the vm
  2. created a directory with my website at /home/newuser/site
  3. Within webmin

    1. Navigated to Server > Apache
    2. Navigated to Create Virtual Host, and entered settings as follows:

      • Handle connections to address: "any address" (default)
        • kept default checks for "Add name virtual server address (if needed)", and "Listen on address (if needed)"
      • Port: 8080 (with radio button seletected on the port box) (also tried 80, but was mainly trying 8080 or something else, just to make sure it wouldn't interfere with me accessing the Webmin portal)
      • Server name: I've tried both "Automatic" and creating a dummy "myexamplehost.com". Honestly, I don't really need a host name unless its required. Since this is just a development environment, I'm okay with just going to http://my.ip.add.ress:8080
      • Add virtual server to file: kept default "new file under virtual servers directory ..."
      • Copy directives from: kept default "nowhere"
    3. Clicked "Create Now"
    4. Clicked "Apply Changes". I've also tried rebooting the VM.

When I try to run it in the browser on my host machine, it wont load.

Any suggestions on how to get this working? I'm new to Turnkey LAMP VMs and Webmin, so I'm not really sure what I did wrong, or where to start debugging it.

I'm using Windows 7 for my host machine running VMWare Player and the latest Turnkey LAMP. I've made very few changes other than whats been described above. I've tried this with both Bridged and Host-only network settings.

Any suggestions on how to fix, or where to start debugging, would be greatly appreciated! Thanks!

Forum: 
clintdoriot's picture

I also (just now) added a Firewall rule to allow TCP traffic on port 8080, and hit "Apply Configuration". While I think that will be necessary, it still didn't solve the problem.

Jeremy Davis's picture

So adjusting firewall rules won't change anything.

If you want to use port 8080 then you'll need to make sure apache is listening on that port too. I have never successfully managed to get virtual hosts working properly with Webmin (although I'm sure it's possible) so I just edited the config files directly (I created a new config file for each virtual host in /etc/apache2/sites-available/ and enabled it with a2ensite sitename, disableing the current default site with a2dissite default). TBH I think it was actually easier to understand what was going on when editing the files directly, but perhaps thats just me.

I haven't got them handy right now so I can't show you how it was done but after a bit of reading and a little testing I got it all working.

[edit] Just re-reading your post, you have set your test site up in /home/.... so you need to make sure that www-data (the webserver user account) has access to the file(s). It may be better to just make all your vhosts sub-folders of the standard doc root (/var/www).

clintdoriot's picture

Jeremy thanks for the input. I (think I) followed the steps, but its still not loading. Here's what I did...

  • Moved the files from /home/username/sitename to /var/www/sitename
  • copied /etc/apache2/sites-available/default to /etc/apache2/sites-available/sitename
    • Modified the file to be the following (note, I erased the 443 stuff, since I don't need https)

 

NameVirtualHost *:8080
 
<VirtualHost *:8080>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/sitename
</VirtualHost>
 
 
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
 
<Directory /var/www/sitename>
        Options Indexes FollowSymLinks MultiViews
        Order allow,deny
        allow from all
</Directory>
 
  • sudo a2ensite sitename
  • sudo a2dissite default
  • sudo /etc/init.d/apache2 reload

The result:

 

 * Restarting web server apache2                                                apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Tue Jun 05 05:06:54 2012] [warn] NameVirtualHost *:8080 has no VirtualHosts
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[Tue Jun 05 05:06:56 2012] [warn] NameVirtualHost *:8080 has no VirtualHosts
                                                                         [ OK ]
 
And it won't start. Did I follow those directions correctly?
 
Jeremy Davis's picture

from memory you need to add the port to the ports.conf (in /etc/apache2/) IIRC it's 'listen 8080'. Also the I think that there should be a trailing slash: <Directory /var/www/sitename/>

Other than that I'm not sure OTTOMH and I'm no authority on these things. Everytime I've set it up I end up having to google for thedetails and keep meaning to document it, but forget. If I get a chance at work tomorrow I'll have a look....

clintdoriot's picture

Thanks Jeremy! That last "listen 8080" command did the trick. Though I put it in the conf file for that virtual host. Does it make a difference between putting it there vs putting it in ports.conf?

Jeremy Davis's picture

Technically not because Apache just reads all the config files (if you wanted you could put everything including the virtual host configs in /etc/apache2/apache.conf). But for ease of use (for yourself or others if someone has to come back and fix it later) it is generally advisable to stick to the Ubuntu/Debian conventions (ie use ports.conf for setting). But at the end of the day if you are the only one using it, then do whatever works for you! :)

Add new comment