国产chinesehd精品酒店,邱淑贞aa极毛片,国产在线色视频,玖玖爱zh综合伊人久久

網(wǎng)站首頁
手機(jī)版

OPENBSD-3.8上快速安裝和配置apache+mysql+php+ssl

更新時(shí)間:2024-02-22 00:07:20作者:佚名

OPENBSD-3.8上快速安裝和配置apache+mysql+php+ssl

本文旨在用OPENBSD自己提供的軟件安裝包來搭建服務(wù)器環(huán)境,當(dāng)然你也可以下載原代碼包編譯安裝,但這樣就費(fèi)時(shí)費(fèi)力了。實(shí)際上OPENBSD給我們提供了大量的編譯好的二進(jìn)制安裝包,利用這些二進(jìn)制安裝包我們可以快速部署我們需要的服務(wù)器環(huán)境,不僅省時(shí)還可以保障OPENBSD的安全性,還可以自動(dòng)解決各個(gè)安裝包之間的包依賴問題(用pkg_add來安裝遠(yuǎn)程服務(wù)器上的軟件包,包依賴問題會自動(dòng)處理不需要認(rèn)為干預(yù),這個(gè)有點(diǎn)像通過PORT安裝)。下面的文檔在一個(gè)E文的文檔基礎(chǔ)上經(jīng)過整理補(bǔ)充后形成的,那個(gè)E文檔找不到了。

設(shè)立網(wǎng)絡(luò)安裝服務(wù)器的地址:

# export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/3.8/packages/i386/

1. 配置APACHE服務(wù)器:

因?yàn)锳PACHE是系統(tǒng)默認(rèn)安裝的,這里就省去了安裝過程,下面配置APACHE這樣就可以開機(jī)運(yùn)行HTTP了因?yàn)樵?ETC/RC腳本中已經(jīng)有了HTTPD服務(wù)的啟動(dòng)設(shè)置

# vi /etc/rc.conf
改:
httpd_flags=NO
為:
httpd_flags=""

對apache做一初步設(shè)置
# vi /var/www/conf/httpd.conf

ExtendedStatus On
ServerAdmin llzqq@126.com
ServerName llzqq.3322.org
ServerTokens Prod
ServerSignature Off
Options Indexes FollowSymLinks 改為 Options FollowSymLinks

2. 安裝mysql-server-4.0.24p1:

# pkg_add -v mysql-server-4.0.24p1.tgz
# cp /usr/local/share/mysql/my-medium.cnf /etc/my.cnf

如果不想讓其他機(jī)器連接MYSQL,可以通過下面的操作實(shí)現(xiàn):

# vi /etc/my.cnf

bind-address = 127.0.0.1

啟動(dòng)MYSQL-SERVER服務(wù)器:

# /usr/local/bin/mysqld_safe &

設(shè)置ROOT的MYSQL密碼:

# /usr/local/bin/mysqladmin -u root password mypass

為了方便啟動(dòng)和關(guān)閉MYSQL服務(wù)建立了下面的腳本:

# vi /etc/rc.d/mysqld.sh
========================================================
#!/bin/sh
# made by llzqq
# mail:openbsd@163.com
# 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

設(shè)置開機(jī)啟動(dòng)MYSQL

# vi /etc/rc.local

if [ -f /etc/my.cnf ]; then
/etc/rc.d/mysqld.sh start
fi

3. 安裝配置PHP-4.4.1

# pkg_add -v php4-core-4.4.1p0.tgz

運(yùn)行下面的命令使其生效
# cp /usr/local/share/examples/php4/php.ini-recommended /var/www/conf/php.ini
# /usr/local/sbin/phpxs -s

由于OPENBSD上的APACHE采用了CHROOT機(jī)制,要保證PHP正常工作就要建下面的目錄PHP工作目錄:

# mkdir /var/www/tmp
# chmod 1777 /var/www/tmp

下面選擇安裝幾個(gè)PHP組件:

# pkg_add -v php4-gd-4.4.1p0-no_x11.tgz
# /usr/local/sbin/phpxs -a gd

# pkg_add -v php4-mysql-4.4.1p0.tgz
# /usr/local/sbin/phpxs -a mysql

# pkg_add -v php4-ncurses-4.4.1p0.tgz
# /usr/local/sbin/phpxs -a ncurses

# pkg_add -v php4-imap-4.4.1p0.tgz
# /usr/local/sbin/phpxs -a imap

# pkg_add -v php4-curl-4.4.1p0.tgz
# /usr/local/sbin/phpxs -a curl

# pkg_add -v php4-dbx-4.4.1p0.tgz
# /usr/local/sbin/phpxs -a dbx

# pkg_add -v php4-ldap-4.4.1p0.tgz
# /usr/local/sbin/phpxs -a ldap

# pkg_add -v php4-pdf-4.4.1p0.tgz
# /usr/local/sbin/phpxs -a pdf

# pkg_add -v php4-snmp-4.4.1p0.tgz
# /usr/local/sbin/phpxs -a snmp

設(shè)置apache支持PHP:

# 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實(shí)驗(yàn)一下

4. 安裝mod_limitipconn模塊來限制單IP的并發(fā)連接數(shù)

# wget http://dominia.org/djao/limit/mod_limitipconn-0.04.tar.gz
# tar xzf mod_limitipconn-0.04.tar.gz
# cd mod_limitipconn-0.04
# vi Makefile

APXS = /usr/sbin/apxs

# make
# make install

讓APACHE支持這個(gè)模塊:
# vi /var/www/conf/httpd.conf

<IfModule mod_limitipconn.c>
<Location />
MaxConnPerIP 5
</Location>
</IfModule>

到次整個(gè)安裝過程結(jié)束。

附件部分:

我們?yōu)樽孉PACHE支持SSL傳輸配置APACHE:

# vi /var/www/conf/httpd.conf
添加下面兩行:
SSLCertificateFile /etc/ssl/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key

為了使APACHE啟動(dòng)時(shí)啟用SSL,設(shè)置一下APACHE啟動(dòng)選項(xiàng):

# vi /etc/rc.conf.local
改:
httpd_flags="" # or it could have httpd_flags=NO
為:
httpd_flags="-DSSL # or it could have httpd_flags=NO

手動(dòng)啟動(dòng)和關(guān)閉APACHE這樣做就可以了:

# apachectl startssl
# apachectl stop

下面是設(shè)置APACHE+SSL的過程:

1. 創(chuàng)建服務(wù)器KEY文件 (1024 bit) :

# /usr/sbin/openssl genrsa -out /etc/ssl/private/server.key 1024

2. 創(chuàng)建服務(wù)器CSR文件(certificate signing request)

# /usr/sbin/openssl req -new -key /etc/ssl/private/server.key -out /etc/ssl/private/server.csr

這里自己填寫一些注冊信息

3. 生成簽名證書(365天有效證書):

# /usr/sbin/openssl x509 -req -days 365 -in /etc/ssl/private/server.csr -signkey /etc/ssl/private/server.key -out /etc/ssl/server.crt

4. 虛擬主機(jī)部分:

NameVirtualHost 192.168.10.1:*

<VirtualHost 192.168.10.1:443>
ServerAdmin llzqq@126.com
DocumentRoot /var/www/llzqq
ServerName llzqq.home.com
ErrorLog logs/llzqq.home.com-error_log
CustomLog logs/llzqq.home.com-access_log common
SSLEngine on
SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
SSLCertificateFile /etc/ssl/virtualsite.com.crt
SSLCertificateKeyFile /etc/ssl/private/server.key

</VirtualHost>

<VirtualHost 192.168.10.1:80>
ServerAdmin llzgg@126.com
DocumentRoot /var/www/llzgg
ServerName llzgg.home.com
ErrorLog logs/llzgg.home.com-error_log
CustomLog logs/llzgg.home.com-access_log common

</VirtualHost>

本文標(biāo)簽: 服務(wù)器  安裝包  還可以