Explore BrainMass

Explore BrainMass

    Using Apache to create a virtual host

    Not what you're looking for? Search our solutions OR ask your own Custom question.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Step 1: Create a Virtual Host

    1. Create a new directory "private_club" within the DocumentRoot directory
    2. Create a new virtual host on your server with the name "www.private_club.com" that uses the directory you created in (1) as the DocumentRoot for the virtual host

    Step 2: Add support for PHP

    1. Add support for php files on the www.private_club.com virtual host. (This can be done in more than one way, but you only have to do it one way.) PHP files are a kind of CGI application, so you will have to configure the directory appropriately and add the necessary handlers.)

    Step 3: .htaccess

    1. Require anyone accessing the directory to login using the login "member" and password "secret"

    Step 4: Testing

    You can not test the virtual host portion of the project, but you can test the PHP and .htaccess portions. For PHP, you will have to install PHP from http://www.php.net/downloads.php. You will also need a PHP file to test.

    PHP files are HTML pages with code embedded in the page itself, similar to a server side include. To create a php file, open a text editor and enter the following:

    <html>
    <head><title>This is a test!</title></head>
    <body>
    <h1>
    <?php
    print "Hello, world!n";
    ?>
    </h1>
    </body>
    </html>

    Save the file as hello.php into the proper directory on your server. When you open the file with a browser, you should get a page that says "Hello world!"

    © BrainMass Inc. brainmass.com March 4, 2021, 7:47 pm ad1c9bdddf
    https://brainmass.com/computer-science/memory-management/apache-create-virtual-host-122555

    Attachments

    $2.49

    ADVERTISEMENT