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

2012年2月11日 星期六

MySQL安裝指南

安裝MySQL

sudo apt-get install mysql-server

這個應該很簡單了,而且我覺得大家在安裝方面也沒什麼太大問題,所以也就不多說了,下面我們來講講配置。

配置MySQL

注意,在Ubuntu下MySQL缺省是只允許本地訪問的,如果你要其他機器也能夠訪問的話,那麼需要改變/etc/mysql/my.cnf配置文件了!下面我們一步步地來:

默認的MySQL安裝之後根用戶是沒有密碼的,所以首先用根用戶進入:

$mysql -u root

在這裏之所以用-u root是因為我現在是一般用戶(firehare),如果不加-u root的話,mysql會以為是firehare在登錄。注意,我在這裏沒有進入根用戶模式,因為沒必要。一般來說,對mysql中的數據庫進行操作,根本沒必要進入根用戶模式,只有在設置時才有這種可能。

進入mysql之後,最要緊的就是要設置Mysql中的root用戶密碼了,否則,Mysql服務無安全可言了。

mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY "123456";

注意,我這兒用的是123456做為root用戶的密碼,但是該密碼是不安全的,請大家最好使用大小寫字母與數字混合的密碼,且不少於8位。

這樣的話,就設置好了MySQL中的root用戶密碼了,然後就用root用戶建立你所需要的數據庫。我這裏就以xoops為例:

mysql>CREATE DATABASE xoops;

mysql>GRANT ALL PRIVILEGES ON xoops.* TO xoops_root@localhost IDENTIFIED BY "654321";

這樣就建立了一個xoops_roots的用戶,它對數據庫xoops有着全部權限。以後就用xoops_root來對xoops數據庫進行管理,而無需要再用root用戶了,而該用戶的權限也只被限定在xoops數據庫中。

如果你想進行遠程訪問或控制,那麼你要做兩件事:

其一:

mysql>GRANT ALL PRIVILEGES ON xoops.* TO xoops_root@"%" IDENTIFIED BY "654321";

允許xoops_root用戶可以從任意機器上登入MySQL。

其二:

$sudo gedit /etc/mysql/my.cnf

老的版本中

>skip-networking => # skip-networking

新的版本中

>bind-address=127.0.0.1 => bind-address= 你機器的IP

這樣就可以允許其他機器訪問MySQL了。

查詢UBUNTU檔案大小指令

du --max-depth=1 -xh | sort -n

2012年2月10日 星期五

姑姪的電腦真"大"台



WINDOWS7 安裝在SSD固態硬碟的PC的注意事項

有些主機板裝WINDOWS7會有不明錯誤,以下是注意的地方:

1.注意光碟挑片問題
2.WINDOWS7 32位元只能插4GB安裝系統
3.主機板調成IDE模式
4.移除獨立顯示卡
5.BIOS電源選項~把硬碟休眠關掉 (LIAO HAHA經驗分享)
以上為相關安裝經驗!

調整 Apache & MySQL 連線數

調整 Apache & MySQL 連線數

Apache 與 MySQL 的預設連線數都是 100

Apache 部份需要修改 httpd.conf

MaxKeepAliveRequests 10000 //增加到 10,000 人

MySQL 的部份修改 /etc/my.cnf

set-variable = max_connections=10000 // 同樣也加到 10,000 人
版本提示!!!
# MySQL 5
max_connections=500            # 全部接受的最大連線數
max_user_connections=20     # 每個使用者最大連線數

# MySQL 4
set-variable=max_connections=500            # 全部接受的最大連線數

set-variable=max_user_connections=20     # 每個使用者最大連線數

2012年2月9日 星期四

Apache調校效能限制設定

提校效能限制設定:

<IfModule prefork.c>
# number of server processes to start
# http://httpd.apache.org/docs/2.2/mod/mpm_common.html#startservers
StartServers 128
# minimum number of server processes which are kept spare
# http://httpd.apache.org/docs/2.2/mod/prefork.html#minspareservers
MinSpareServers 16
# maximum number of server processes which are kept spare
# http://httpd.apache.org/docs/2.2/mod/prefork.html#maxspareservers
MaxSpareServers 64
# highest possible MaxClients setting for the lifetime of the Apache process.
# http://httpd.apache.org/docs/2.2/mod/mpm_common.html#serverlimit
ServerLimit 2048
# maximum number of server processes allowed to start
# http://httpd.apache.org/docs/2.2/mod/mpm_common.html#maxclients
MaxClients 2048
# maximum number of requests a server process serves
# http://httpd.apache.org/docs/2.2/mod/mpm_common.html#maxrequestsperchild
MaxRequestsPerChild 10000
</IfModule>

重啟 apache 請先 stop 再 start。


/etc/init.d/apache2 stop
/etc/init.d/apache2 start