2

I have a LAMP installed on my computer without problems. I can go to http://localhost and it will by default show the contents of /var/www .

Is there a way to add new "domains" that refrence localhost? For example, can I do a http://johndesktop and have that point to /home/john/Desktop folder?

I just want to use something other than the word "localhost".

1 Answer 1

2

Yes you can put entries in your /etc/hosts file; the first line should look like this ->
127.0.0.1 localhost

Change it to
127.0.0.1 localhost johndesktop

Then you need to edit your apache vhosts config and add a record for johndesktop to point to the desired folder, something like this in httpd-vhosts.conf

<VirtualHost *>
    DocumentRoot /home/john/Desktop
    ServerName johndesktop
    ErrorLog logs/Desktop-error_log
    CustomLog logs/Desktop-access_log common
<Directory /home/john/Desktop>
        Order allow,deny
        Allow from all
        Options Indexes FollowSymLinks
</Directory>
</VirtualHost>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .