2012年2月12日 星期日

MYSQL PHPMYADMIN 更換WEB管理介面PORT


remove symlink to phpmyadmin.conf file
Code:
rm /etc/apache2/conf.d/phpmyadmin.conf
make apache listen on port 81 (or what ever you desire.)
Code:
sudo nano /etc/apache2/ports.conf
Add "Listen 81" to the file.
Code:
user@mythtv:/etc/apache2$ cat ports.conf 
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz

NameVirtualHost *:80
Listen 80
Listen 81
<IfModule mod_ssl.c>
    # SSL name based virtual hosts are not yet supported, therefore no
    # NameVirtualHost statement here
    Listen 443
</IfModule>
Now create the vHost:
Code:
sudo vi /etc/apache2/sites-available/phpmyadmin
add the following to the file: 
Code:
<VirtualHost *:81>
  ServerName phpmyadmin
  DocumentRoot /var/www-81
</VirtualHost>
Enable the vHost:
Code:
sudo a2ensite phpmyadmin
Restart Apache:
Code:
sudo service apache2 restart
Create a symlink to the phpmyadmin directoy:
Code:
cd /var/www-81
sudo ln -s /usr/share/phpmyadmin/
At this point navigating to http://ip/phpmyadmin should not show the page. but http://ip:81/phpmyadmin should.


並將/etc/mysql/apache2.conf 裡的Alias移除!

This is just a friendly warning and not really a problem (as in that something does not work).
If you insert a
ServerName localhost   
in either httpd.conf or apache2.conf in /etc/apache2 and restart apache the notice will disappear.
If you have a name inside /etc/hostname you can also use that name instead of localhost.

And it uses 127.0.1.1 if it is inside your /etc/hosts:
127.0.0.1 localhost
127.0.1.1 myhostname
Troubleshooting Apache
If you get this error:
apache2: Could not determine the server's fully qualified domain name, 
using 127.0.0.1 for ServerName
then use a text editor such as "sudo nano" at the command line or "gksudo gedit" on the desktop to create a new file,
sudo nano /etc/apache2/conf.d/fqdn
or
gksu "gedit /etc/apache2/conf.d/fqdn"
then add
ServerName localhost
to the file and save. This can all be done in a single command with the following:
 echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn