How to set up a VirtualHost on Amazon EC2 for phpmyadmin
Posted
by
Oudin
on Ask Ubuntu
See other posts from Ask Ubuntu
or by Oudin
Published on 2012-06-13T13:17:50Z
Indexed on
2012/06/22
15:25 UTC
Read the original article
Hit count: 363
phpmyadmin
|virtualhost
Hi I'm currently working on setting up a VirtualHost on Amazon EC2 for accessing phpmyadmin so i can access it with test.example.com as oppose to it being widely available as it's default example.com/phpmyadmin.
So far I've created a file "testfile" in /etc/apache2/sites-available/ with the code below and enabled it "a2ensite testfile" However I'm not getting the vhost to work
<VirtualHost *:80>
ServerAdmin [email protected]
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
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.
Any help on this would be greatly appreciated.
Note: example.com will be replaced with my official domain
© Ask Ubuntu or respective owner