FreeBsd 有關apache php5 mysql 架站

freebsd web server

架設apache22 + mysql51 + php5 + php5-extensions + phpmyadmin

1.mysql server
cd /usr/ports/databases/mysql51-server
make -DWITH_CHARSET=big5 -DWITH_XCHARSET=all install clean

2.apache server
cd /usr/ports/www/apache22
make install clean

3.php5 language
cd /usr/ports/lang/php5
make config
[X] APACHE Build Apache module
make install clean

4.php extensions module
cd /usr/ports/lang/php5-extensions
make config
[X] MYSQL MySQL database support
[X] MYSQLI MySQLi database support
make install clean


5.mysql phpmyadmin
cd /usr/ports/databases/phpmyadmin
make install clean

以上都裝好之後開始設定
1. apache 設定
cd /usr/local/etc/apache22
設定httpd.conf
+ServerAdmin femc7488@gmail.com
+ServerName www.hsian.org:80
+DocumentRoot "/usr/local/www"
+<Directory "/usr/local/www">
+DirectoryIndex index.html index.htm index.php
+ScriptAlias /cgi-bin/ "/usr/local/www/cgi-bin/"

+Addtype application/x-httpd-php .php
+Addtype application/x-httpd-php-source .phps

+Include etc/apache22/extra/httpd-userdir.conf
+Include etc/apache22/extra/httpd-vhosts.conf

設定httpd-vhosts.conf
28 DocumentRoot "/usr/local/www/"
29 ServerName www.hsian.org
30

33 DocumentRoot "/usr/local/www/blog_img"
34 ServerName blogimg.hsian.org
35 ErrorLog /var/log/blog-error_log
36 CustomLog /var/log/blog-access_log common
37
40 DocumentRoot "/usr/local/www/blog"
41 ServerName blog.hsian.org
42 ErrorLog /var/log/blog-error_log
43 CustomLog /var/log/blog-access_log common
44
47 DocumentRoot "/usr/local/www/phpMyAdmin"
48 ServerName mysql.hsian.org
49 ErrorLog /var/log/mysql-error_log
50 CustomLog /var/log/mysql-access_log common

2. 開機啟動
apache22_enable="YES"
apache22_http_accept_enable="YES"
mysql_enable="YES"

3. 啟動
/usr/local/etc/rc.d/apache22 start
/usr/local/etc/rc.d/mysql-server start

4. phpmyadmin
cd /usr/local/www/phpMyAdmin
mkdir config
chmod o+w config/
cp config.inc.php config/
chmod o+rw config/config.inc.php

http://xxxxx/phpmyadmin/scripts/setup.php
Server->Add
set Connection type=socket
set Authentication type=http
set PHP extension to use=mysqli
Configuration->Save

這下剛剛建立的config裡面就有產生出來的設定檔了
cp config/config.inc.php .

留言