Greetings everyone,

trying to teach myself some web development, I've installed the LAMP stack in Virtual Box. It seems to work, as I can browse to the front page from the host machine, but for the life of me, I can't figure out what next. I've been using Ubuntu for some time, but have to admit complete and utter ignorance as far as Apache configuration goes. For a week now, I've been trying to access the html file I had created on the server, reading Apache2 documentation, searching the web, all to no avail. I've tried modifyig the httpd.conf file according to the following example from the apache docs, but it only made the front page inaccessible.

 

<VirtualHost 10.1.2.3:80>
ServerAdmin webmaster@host.example.com
DocumentRoot /www/docs/host.example.com
ServerName host.example.com
ErrorLog logs/host.example.com-error_log
TransferLog logs/host.example.com-access_log

</VirtualHost>

 

The goal is to be abale to simply access the web pages I create by going to something like http://192.168.56.101/index.html. Can someone tell me how it's done.

Forum: 
Jeremy Davis's picture

If you want to retain the current TKL landing page, rename the current index  page to tkl (eg index.html -> tkl.html) in the default doc root (/var/www) and then load your page in there. If you make sure your page is called index.html/.htm/.php/etc (extension to match code) then it will automatically get picked up when you browse to http://192.168.56.101/

If you'd rather leave what's there alone, you can just add a folder to the doc root and access it via http://192.168.56.101/newfolder/

Also if you look at your apache config above, you have specified your web site as 10.1.2.3 which won't work unless that the IP of your LAMP. Easy fix replace the IP with a '*' eg <VirtualHost *:80>. Also the config you used points to a folder /www/docs/host.example.com does that folder exist on your system? Also it is not advised to use example.com as it is a reserved domain. Either put in a real domain (that points to your server) and/or edit the hosts file on your host PC and point the domain to your LAMP server.

Apache config is not my strength but Webmin is a good option if you want to change things. If you want to add a new site manually base it on the default by copying the default to a new site and open it for editing:

cd /etc/apache2/sites-available
cp default newsite
nano newsite

You can then disable the original and enable your newsite like this:

a2dissite default
a2ensite newsite

You need to restart apache for config changes to apply:

service apache2 restart

Thank you for the quick and informative reply. I've been recovering, having been more then a bit shaken by the steep learning curve. Hopefully, I'll master up determination and try your suggestions over a weeked. Incidentally, is there a howto I should have been reading?

Jeremy Davis's picture

FYI keep in mind that TKL v11.x appliances are based on Ubuntu 10.04/Lucid Server. There is lots of Apache info online although there are a few idiosyncracies of the Debian/Ubuntu packages so the Apache2 page from the Ubuntu Server Guide is probably the best place to start. You'll find some more links at the bottom of the page and Google will give you plenty of hits too. Ubuntu forums are also a great place to search/post for info.

As said, I'd been searching and reading apache documentation for a week before posting here, but the problem was that the documentation proved so vastly diverse and exhostive that the more I've tried reading, the more lost I've become.  All I really needed was a baby step on how to get started with apache, or where to place the files, but could not find it anywhere.

Anyway, the project is on hold now, till I have the time to study the documentation.

Thank you for the replies.

Add new comment