Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Hi I'm currently working on setting up a VirtualHost on Amazon EC2 for accessing phpmyadmin so it won't be widly available as it's default example.com/phpmyadmin.

So far I've created a file "testfile" in /etc/apache2/sites-available/ and enabled

<VirtualHost *:80>
            ServerAdmin webmaster@example.com

            ServerName test.example.com
            ServerAlias test.example.com

            #DocumentRoot /usr/share/phpmyadmin
            DocumentRoot /home/user/public_html/folder

            RewriteEngine On
            RewriteCond %{HTTP_HOST} !test.example.com
            RewriteRule (.*) [L]


            <Directory /home/user/public_html/folder>


                    #Options FollowSymLinks
                    #DirectoryIndex index.php

                    Options Indexes FollowSymLinks ExecCGI
                    AllowOverride None

                    <IfModule mod_php5.c>
                            AddType application/x-httpd-php .php

                            php_flag magic_quotes_gpc Off
                            php_flag track_vars On
                            php_flag register_globals Off
                            php_admin_flag allow_url_fopen Off
                            php_value include_path .
                            php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
                            php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/
                    </IfModule>

            </Directory>
     # Authorize for setup
            <Directory /usr/share/phpmyadmin/setup>
                <IfModule mod_authn_file.c>
                AuthType Basic
                AuthName "phpMyAdmin Setup"
                AuthUserFile /etc/phpmyadmin/htpasswd.setup
                </IfModule>
                Require valid-user
            </Directory>

            # Disallow web access to directories that don't need it
            <Directory /usr/share/phpmyadmin/libraries>
                Order Deny,Allow
                Deny from All
            </Directory>
            <Directory /usr/share/phpmyadmin/setup/lib>
                Order Deny,Allow
                Deny from All
            </Directory>

            ErrorLog /home/user/public_html/folder/logs/error.log
            LogLevel warn
            CustomLog /home/user/public_html/folder/logs/access.log combined

    </VirtualHost>

sudo ln -s /usr/share/phpmyadmin /home/user/public_html/folder

The above line creates a link of the phpmyadmin in the public folder.

However I'm not getting the the vhost to work i believe it's looking for a DNS record for test.example.com as oppose to the actual vhost

any help on getting this working would be greatly appreciated.

Note: example.com will be replaced with my official domain

share|improve this question

migrated from stackoverflow.com Jun 15 '12 at 9:13

This question came from our site for professional and enthusiast programmers.

    
Cool! But that's not a question... –  Paulpro Jun 13 '12 at 19:16
    
I need help getting the vhost to work as it's suppose too –  Oudin Jun 13 '12 at 22:30
    
"However I'm not getting the the vhost to work i believe it's looking for a DNS record for test.example.com" It shouldnt be. You're simply telling apache to check the Host field in the http request for test.example.com What do your access & error logs say? –  GeoSword Aug 12 '13 at 9:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.