llzqq < [email protected] >
歡迎大家轉貼這個文章,但要保留下面的版權信息:
本文旨在用OPENBSD自己提供的安裝包來搭建服務器環境,當然你也可以下載原代碼包編譯安裝,但這樣OPENBSD的安全就不容易保證了。因為各個包之間有依賴性關系所以下面列出了本文中用到的所有安裝包大家把下面的所有包復制到一個目錄中安裝就很順利了:
freetype-1.3.1p1.tgz
jpeg-6b.tgz
php4-core-4.3.8.tgz
php4-gd-4.3.8-no_x11.tg
png-1.2.5p5.tgz
recode-3.6p1.tgz
t1lib-5.0.0.tgz
tiff-3.6.1p1.tgz
mysql-client-4.0.20.tgz
mysql-server-4.0.20.tgz
p5-DBD-mysql-2.9004.tgz
p5-DBI-1.43.tgz
p5-Net-Daemon-0.38.tgz
p5-PlRPC-0.2018.tgz
p5-PlRPC-0.2018.tgz.1
mod_limitipconn-0.04.tar.gz
下載地址:
http://ftp.it.net.au/OpenBSD/3.6/packages/i386/
http://dominia.org/djao/limit/mod_limitipconn-0.04.tar.gz
因為APACHE是系統默認安裝的,這裡就省去了安裝過程
下面配置APACHE以便可以開機運行
# vi /etc/rc.conf改:
httpd_flags=NO為:
httpd_flags=""
對apache做一初步設置
# vi /var/www/conf/httpd.conf ServerAdmin [email protected] ServerName nero.3322.org ServerTokens Prod ServerSignature EMail
# pkg_add mysql-server-4.0.20.tgz # cp /usr/local/share/mysql/my-medium.cnf /etc/my.cnf如果不想讓其他機器連接MYSQL,可以通過下面的操作實現:
# vi /etc/my.cnf bind-address = 127.0.0.1啟動MYSQL-SERVER服務器:
# /usr/local/bin/mysqld_safe &設置ROOT的MYSQL密碼:
# /usr/local/bin/mysqladmin -u root password your_password為了方便啟動和關閉MYSQL服務建立了下面的腳本:
# vi /etc/rc.d/mysqld.sh ======================================================== #!/usr/local/bin/bash # made by llzqq # 02/08/ 2004 # mysql startup scripts case "$1" in start) if [ -x /usr/local/bin/mysqld_safe ]; then /usr/local/bin/mysqld_safe & fi ;; stop) pkill mysqld & rm -f /var/run/mysql/mysql.sock & ;; *) echo "$0 start | stop" ;; esac exit 0 ======================================================== # chmod 555 /etc/rc.d/mysqld.sh
設置開機啟動MYSQL
# vi /etc/rc.local if [ -f /etc/my.cnf ]; then . /etc/rc.d/mysqld.sh start fi
# pkg_add php4-gd-4.3.8-no_x11.tgz
運行下面的命令使其生效
# cp /usr/local/share/doc/php4/php.ini-recommended /var/www/conf/php.ini # /usr/local/sbin/phpxs -s # /usr/local/sbin/phpxs -a gd
由於OPENBSD上面的APACHE采用了CHROOT機制,要保證PHP正常工作就要建下面的目錄作為PHP的工作目錄:
# mkdir /var/www/tmp # chmod 1777 /var/www/tmp
# pkg_add php4-mysql-4.3.8.tgz運行下面的命令使其生效
# /usr/local/sbin/phpxs -a mysql
# pkg_add php4-ncurses-4.3.8.tgz運行下面的命令使其生效
# /usr/local/sbin/phpxs -a ncurses
# pkg_add php4-imap-4.3.8.tgz運行下面的命令使其生效
# /usr/local/sbin/phpxs -a imap
# vi /var/www/conf/httpd.conf DirectoryIndex index.html index.php AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps # vi /var/www/conf/php.ini doc_root= "/htdocs" register_globals = On
建立測試php頁面
# vi /var/www/htdocs/test.php <?php phpinfo(); ?>
測試一下:
# pkill httpd # /usr/sbin/httpd
在浏覽器中輸入http://IP/test.php實驗一下
# tar xzf mod_limitipconn-0.04.tar.gz # cd mod_limitipconn-0.04 # vi Makefile APXS = /usr/sbin/apxs # make # make install # vi /var/www/conf/httpd.conf <IfModule mod_limitipconn.c> <Location /> MaxConnPerIP 3 </Location> </IfModule>
Openbsd 3.8上安裝配置 APACHE + MYSQL + PHP + mod_limitipco
Openbsd 3.6 + APACHE + MYSQL + PHP + mod_limitipconn
在 FreeBSD 6.1 安裝 Apache+MySQL+PHP
OPENBSD-3.8上快速安裝和配置apache+mysql+php+ssl
Openbsd 3.8上安裝配置 APACHE + MYSQL + PHP + mod_limitipco
Linux-Apache+Mysql+PHP+PHPWind(重點Apache+PHP集成環境),apachemysqlphp集成