王朝网络
分享
 
 
 

用FreeBSD+Windows架设个人WEB服务器

王朝system·作者佚名  2006-12-16
宽屏版  字体: |||超大  

硬件 two PC

操作系统 FreeBSD-4.7 release

Windows 2000 professional

所需软件 for FreeBSD

apache_1.3.27.tar.gz for UNIX

php-4.3.1.tar.gz

mysql-3.23.56.tar.gz for FreeBSD

mod_gzip_1.3.19.1a.tar.gz

ZendOptimizer-2.1.0a.tar.gz for FreeBSD

ez-ipupdate-3.0.10.tar.gz

samba-2.2.8.tar.gz

for Win32

apache,php,mysql,ZendOptimizer,phpMyAdmin的win32版本

ApacheModuleGzip.dll.zip

Macromedia Dreamweaver MX

EditPlus 2

架设示意:

因特网

-------------------------------------------------------------

|

|

|

-------------------------------------------------------------

网卡0 <-动态IP解析用ez-ipupdate

FreeBSD上

防火墙 ipfw

WEB服务器 apache<-传输加速用mod_gzip

数据库接口 php <-接口加速用ZendOptimizer

数据库服务器 mysql <-数据库管理用phpMyAdmin

文件共享服务器 samba

网卡1

-------------------------------------------------------------

|

|

|

-------------------------------------------------------------

网卡

Windows 2000 professional上

装有apache+php+mysql以及Macromedia Dreamweaver MX和EditPlus 2

是局域网中唯一的客户机

-------------------------------------------------------------

你要达到的目的:

1 用FreeBSD作带有防火墙的WEB服务器,MySQL数据库服务器及samba服务器的同时,充当局域网的网关;

2 利用建立在Windows上的WEB服务器,MySQL服务器,Macromedia Dreamweaver MX及EditPlus 2编辑调试网页;

3 利用Windows上的phpMyAdmin管理FreeBSD上的MySQL数据库;

3 利用FreeBSD上的samba服务器将调试好的网页从Windows转移到FreeBSD上,让因特网能访问到你的杰作;

4 学习和练习组网;

5 在Windows上上网冲浪。

安装和配置

之前的废话:假设你已经

1 成功地在两台机器上分别安装了FreeBSD(建议安装成以命令行形式运行)并增加了一名用户假设为:winname

和Windows 2000 professional,Windows的计算机名假设为:winname,工作组假设为:workgroup;

2 成功地安装了FreeBSD上的两张网卡和Windows上的一张网卡;

3 有一根双绞线连接FreeBSD上的内网网卡(假设为rl1,下同)和Windows上的网卡;

4 FreeBSD上的另一网卡(假设为rl0,下同)连接因特网;

5 曾经在Windows上用ADSL(动态IP分配形式)成功地连入过因特网,假设用户名:xxx,密码:yyy。

6 申请了希网(http://www.3322.org)动态域名,假设是test.3322.org,用户名:user,密码:passwd

7 牢记winname,workgroup,rl0,rl1,xxx,yyy,user,passwd,因为下面的说明中要用到。要根据自己的情况更改以

上内容。

1 FreeBSD上

以root身份登入FreeBSD

配置rc.conf

# ee /etc/rc.conf

加入或更改如下内容:

gateway_enable="YES"

sendmail_enable="NO"

inetd_enable="NO"

network_interfaces="rl0 rl1 lo0"

ifconfig_rl1="inet 192.168.0.3 netmask 255.255.255.0"

hostname="test.3322.org"

ppp_enable="YES"

ppp_mode="ddial"

ppp_profile="adsl"

ppp_nat="YES"

#ipfw_enable="YES"

#ipfw_type="/etc/ipfw.conf"

按“Ctrl+[”,存盘退出。

配置ppp.conf

# ee /etc/ppp/ppp.conf

加入或更改如下内容,清除其它内容:

default:

set log Phase tun command

set ifaddr 10.0.0.1/0 10.0.0.2/0

adsl:

set device PPPoE:rl0

set authname:xxx

set authkey:yyy

set dial

set login

enable dns

add default HIADDR

按“Ctrl+[”,存盘退出。

配置hosts.conf

# ee /etc/hosts.conf

加入或更改如下内容:

::1 localhost localhost.my.domain

127.0.0.1 localhost localhost.my.domain

test test.8866.org

按“Ctrl+[”,存盘退

||||||

出。

# reboot

再次以root身份登入FreeBSD

test# ifconfig

你会发现有一些变化:

如果Windows 2000也开了机,那么rl0和rl1都处于active状态,rl1的ip被设为192.168.0.3,而且通过拨号设备tun0(ADSL)开机时自动拨了

号,你临时拥有了一个公网ip。

test# killall ppp

记录DNS服务器的ip:

test# ee /etc/resolv.conf

你会发现一些东西,是你虚拟拨号上网时用的DNS服务器的ip,把它们记录下来:

nameserver xxx.xxx.xxx.xxx

nameserver yyy.yyy.yyy.yyy

...

按“Ctrl+[”,不存盘退出。

编译和安装WEB服务器,MySQL服务器和samba服务器

最初的时候,你得想办法把apache以及其他的*.tar.gz文件弄到FreeBSD上的一个分区(比如安装FreeBSD的时候建立一个单独分区/sos)里备

用,如果重新安装FreeBSD,就可以保留/sos里的这些宝贵的*.tar.gz文件了。将/sos内所有的*.tar.gz文件解压缩在/sos里。

test# cd /sos

test# gunzip < /sos/*.tar.gz | tar xvf -

apache

编译安装(将apache安装到目录/usr/local/www,你也可以更改目录)

test# cp -R /sos/apache_1.3.27 /usr/local/apache

test# chmod -R 755 /usr/local/apache

test# ee /usr/local/apache/src/include/httpd.h

#ifndef HARD_SERVER_LIMIT

#ifdef WIN32

#define HARD_SERVER_LIMIT 1024

#elif defined(NETWARE)

#define HARD_SERVER_LIMIT 2048

#else

#define HARD_SERVER_LIMIT 2560 <===修改apache的默认最大进程数256为2560

#endif

#endif

按“Ctrl+[”,存盘退出。

test# cd /usr/local/apache

test# ./configure --prefix=/usr/local/www --enable-shared=max --enable-module=most

test# make

test# make install

mysql

安装(将mysql安装到目录/usr/local/mysql,你也可以更改目录)

test# cp -R /sos/mysql-3.23.56 /usr/local/mysql

test# chmod -R 755 /usr/local/mysql

test# cd /usr/local/mysql

test# pw groupadd mysql

test# pw useradd mysql -g mysql

test# scripts/mysql_install_db

test# chown -R root /usr/local/mysql

test# chown -R mysql /usr/local/mysql/data

test# chgrp -R mysql /usr/local/mysql

php

编译安装(将php安装到目录/usr/local/www/php,你也可以更改目录)

test# cp -R /sos/php-4.3.1 /usr/local/php

test# chmod -R 755 /usr/local/php

test# cd /usr/local/php

test# ./configure --prefix=/usr/local/www/php --with-apxs=/usr/local/www/bin/apxs --with-mysql=/usr/local/mysql

test# make

test# make install

test# cp /usr/local/php/php.ini-dist /usr/local/www/php/lib/php.ini

mod_gzip

安装

test# cp -R /sos/mod_gzip_1.3.19.1a /usr/local/mod_gzip

test# chmod -R 755 /usr/local/mod_gzip

test# cd /usr/local/mod_gzip

test# /usr/local/www/bin/apxs -i -a -c mod_gzip.c

test# mkdir /tmp/mod_gzip

ZendOptimizer

安装

test# cp -R /sos/ZendOptimizer-2.1.0a /usr/local/zend

test# chmod -R 755 /usr/local/zend

test# cd /usr/local/zend

test# ./install.sh

安装脚本会提及几个关键问题:

1 ZendOptimizer的安装目录:/usr/local/www/Zend(将ZendOptimizer安装到目录/usr/local/www/Zend,你也可以更改目录)

2 php.ini所在目录:/usr/local/www/php/lib

3 apache的bin目录:/usr/local/www/bin

4 apache的配置文件所在目录:/usr/local/www/conf

以及你的apache和php的版本是否为1.3.27和4.3.1这些问题,注意别弄错了。

最后,它问你是否重启apache,选择否后,自动退出,至此ZendOptimize

||||||

r安装成功。

ez-ipupdate-3.0.10

安装

test# cp -R /sos/ez-ipupdate-3.0.10 /usr/local/ez

test# chmod -R 755 /usr/local/ez

samba

编译安装

test# cp -R /sos/samba-2.2.8 /usr/local/smb

test# chmod -R 755 /usr/local/smb

test# cd /usr/local/smb/source

test#./configure --prefix=/usr/local/samba

test# make

test# make install

test# cp /usr/local/smb/examples/smb.conf.default /usr/local/samba/lib/smb.conf

删除编译安装文件:

test# rm -R /usr/local/apache

test# rm -R /usr/local/php

test# rm -R /usr/local/mod_gzip

test# rm -R /usr/local/zend

test# rm -R /usr/local/smb

别删mysql和ez-ipupdate,一般下载的mysql和ez-ipupdate是二进制分发形式,你要直接用它们。

这时你的/usr/local/里会干干净净地只剩下www,samba,ez和mysql四个文件目录,除非你采用标准方式如ports安装了其它软件。

配置服务器

apache的配置文件:httpd.conf

test# ee /usr/local/www/conf/httpd.conf

加入或更改如下内容:

ServerType standalone

#############################################################

ServerName test.8866.org

#############################################################

#############################################################

ServerRoot "/usr/local/www"

#############################################################

PidFile /usr/local/www/logs/httpd.pid

ScoreBoardFile /usr/local/www/logs/httpd.scoreboard

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 15

MinSpareServers 5

MaxSpareServers 10

StartServers 5

MaxClients 256

MaxRequestsPerChild 0

LoadModule vhost_alias_module libexec/mod_vhost_alias.so

LoadModule env_module libexec/mod_env.so

LoadModule config_log_module libexec/mod_log_config.so

LoadModule mime_magic_module libexec/mod_mime_magic.so

LoadModule mime_module libexec/mod_mime.so

#LoadModule negotiation_module libexec/mod_negotiation.so

#LoadModule status_module libexec/mod_status.so

LoadModule info_module libexec/mod_info.so

#LoadModule includes_module libexec/mod_include.so

#LoadModule autoindex_module libexec/mod_autoindex.so

LoadModule dir_module libexec/mod_dir.so

#LoadModule cgi_module libexec/mod_cgi.so

#LoadModule asis_module libexec/mod_asis.so

#LoadModule imap_module libexec/mod_imap.so

#LoadModule action_module libexec/mod_actions.so

LoadModule speling_module libexec/mod_speling.so

#LoadModule userdir_module libexec/mod_userdir.so

#LoadModule alias_module libexec/mod_alias.so

LoadModule rewrite_module libexec/mod_rewrite.so

LoadModule access_module libexec/mod_access.so

#LoadModule auth_module libexec/mod_auth.so

LoadModule anon_auth_module libexec/mod_auth_anon.so

LoadModule dbm_auth_module libexec/mod_auth_dbm.so

LoadModule digest_module libexec/mod_digest.so

LoadModule proxy_module libexec/libproxy.so

LoadModule cern_meta_module libexec/mod_cern_meta.so

LoadModule expires_module libexec/mod_expires.so

LoadModule headers_module libexec/mod_heade

||||||

rs.so

LoadModule usertrack_module libexec/mod_usertrack.so

LoadModule unique_id_module libexec/mod_unique_id.so

#LoadModule setenvif_module libexec/mod_setenvif.so

####################################################################

LoadModule php4_module libexec/libphp4.so

LoadModule gzip_module libexec/mod_gzip.so

####################################################################

ClearModuleList

AddModule mod_vhost_alias.c

AddModule mod_env.c

AddModule mod_log_config.c

AddModule mod_mime_magic.c

AddModule mod_mime.c

#AddModule mod_negotiation.c

#AddModule mod_status.c

AddModule mod_info.c

#AddModule mod_include.c

#AddModule mod_autoindex.c

AddModule mod_dir.c

#AddModule mod_cgi.c

#AddModule mod_asis.c

#AddModule mod_imap.c

#AddModule mod_actions.c

AddModule mod_speling.c

#AddModule mod_userdir.c

#AddModule mod_alias.c

AddModule mod_rewrite.c

AddModule mod_access.c

#AddModule mod_auth.c

AddModule mod_auth_anon.c

AddModule mod_auth_dbm.c

AddModule mod_digest.c

AddModule mod_proxy.c

AddModule mod_cern_meta.c

AddModule mod_expires.c

AddModule mod_headers.c

AddModule mod_usertrack.c

AddModule mod_unique_id.c

AddModule mod_so.c

#AddModule mod_setenvif.c

#################################################################

AddModule mod_php4.c

AddModule mod_gzip.c

#################################################################

Port 80

User nobody

Group nobody

#################################################################

ServerAdmin yourname@test.8866.org

#################################################################

#################################################################

DocumentRoot "/usr/local/www/htdocs"

#################################################################

Options FollowSymLinks

AllowOverride None

rectory>

#################################################################

#################################################################

Options Indexes FollowSymLinks MultiViews

AllowOverride None

Order allow,deny

Allow from all

rectory>

UserDir public_html

Module>

#################################################################

DirectoryIndex index.html index.htm index.php

Module>

#################################################################

AccessFileName .htaccess

Order allow,deny

Deny from all

Satisfy All

les>

UseCanonicalName On

TypesConfig /usr/local/www/conf/mime.types

Module>

DefaultType text/plain

MIMEMagicFile /usr/local/www/conf/magic

Module>

HostnameLookups Off

ErrorLog /usr/local/www/logs/error_log

LogLevel warn

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %b" common

LogFormat "%{Referer}i -> %U" ref

||||||

erer

LogFormat "%{User-agent}i" agent

CustomLog /usr/local/www/logs/access_log common

ServerSignature On

Alias /icons/ "/usr/local/www/icons/"

Options Indexes MultiViews

AllowOverride None

Order allow,deny

Allow from all

rectory>

Alias /manual/ "/usr/local/www/htdocs/manual/"

Options Indexes FollowSymlinks MultiViews

AllowOverride None

Order allow,deny

Allow from all

rectory>

ScriptAlias /cgi-bin/ "/usr/local/www/cgi-bin/"

AllowOverride None

Options None

Order allow,deny

Allow from all

rectory>

Module>

IndexOptions FancyIndexing

AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

AddIconByType (TXT,/icons/text.gif) text/*

AddIconByType (IMG,/icons/image2.gif) image/*

AddIconByType (SND,/icons/sound2.gif) audio/*

AddIconByType (VID,/icons/movie.gif) video/*

AddIcon /icons/binary.gif .bin .exe

AddIcon /icons/binhex.gif .hqx

AddIcon /icons/tar.gif .tar

AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv

AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip

AddIcon /icons/a.gif .ps .ai .eps

AddIcon /icons/layout.gif .html .shtml .htm .pdf

AddIcon /icons/text.gif .txt

AddIcon /icons/c.gif .c

AddIcon /icons/p.gif .pl .py

AddIcon /icons/f.gif .for

AddIcon /icons/dvi.gif .dvi

AddIcon /icons/uuencoded.gif .uu

AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl

AddIcon /icons/tex.gif .tex

AddIcon /icons/bomb.gif core

AddIcon /icons/back.gif ..

AddIcon /icons/hand.right.gif README

AddIcon /icons/folder.gif ^^DIRECTORY^^

AddIcon /icons/blank.gif ^^BLANKICON^^

DefaultIcon /icons/unknown.gif

ReadmeName README

HeaderName HEADER

Module>

AddEncoding x-compress Z

AddEncoding x-gzip gz tgz

AddLanguage da .dk

AddLanguage nl .nl

AddLanguage en .en

AddLanguage et .ee

AddLanguage fr .fr

AddLanguage de .de

AddLanguage el .el

AddLanguage he .he

AddCharset ISO-8859-8 .iso8859-8

AddLanguage it .it

AddLanguage ja .ja

AddCharset ISO-2022-JP .jis

AddLanguage kr .kr

AddCharset ISO-2022-KR .iso-kr

AddLanguage nn .nn

AddLanguage no .no

AddLanguage pl .po

AddCharset ISO-8859-2 .iso-pl

AddLanguage pt .pt

AddLanguage pt-br .pt-br

AddLanguage ltz .lu

AddLanguage ca .ca

AddLanguage es .es

AddLanguage sv .sv

AddLanguage cz .cz

AddLanguage ru .ru

AddLanguage zh-tw .tw

AddLanguage tw .tw

AddCharset Big5 .Big5 .big5

AddCharset WINDOWS-1251 .cp-1251

AddCharset CP866 .cp866

AddCharset ISO-8859-5 .iso-ru

AddCharset KOI8-R .koi8-r

AddCharset UCS-2 .ucs2

AddCharset UCS-4 .ucs4

AddCharset UTF-8 .utf8

LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw

Module>

||||||

hp

#######################################################################

Module>

BrowserMatch "Mozilla/2" nokeepalive

BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0

BrowserMatch "RealPlayer 4\.0" force-response-1.0

BrowserMatch "Java/1\.0" force-response-1.0

BrowserMatch "JDK/1\.0" force-response-1.0

Module>

#############################for expires.c###############################

ExpiresActive on

ExpiresByType image/gif "access plus 1 month"

ExpiresDefault "now plus 1 day"

Module>

#########################################################################

#############################for mod_gzip################################

mod_gzip_on Yes

mod_gzip_minimum_file_size 1000

mod_gzip_maximum_file_size 300000

mod_gzip_item_include file \.html$

mod_gzip_item_include file \.htm$

mod_gzip_item_include file \.php$

mod_gzip_item_include mime text/.*

mod_gzip_item_include mime httpd/unix-directory

mod_gzip_temp_dir /tmp/mod_gzip

mod_gzip_dechunk Yes

mod_gzip_keep_workfiles No

Module>

##########################################################################

按“Ctrl+[”,存盘退出。

php的配置文件:php.ini

test# ee /usr/local/www/php/lib/php.ini

加入或更改如下内容:

register_globals = On

mysql.default_port = 3306

按“Ctrl+[”,存盘退出。

mysql

test# cd /usr/local/mysql

test# ./bin/safe_mysqld --user=mysql &

test# ./bin/mysql

mysql>use mysql

mysql>grant all privileges on *.* to "winname"@"192.168.0.3";

mysql>quit

Bye

test# killall mysqld

samba的配置文件:smb.conf

test# ee /usr/local/samba/lib/smb.conf

加入或更改如下内容并把所有关于printer的部分用“;”注释掉:

#======================= Global Settings =====================================

[global]

workgroup = WORKGROUP

server string = FreeBSD

hosts allow = 192.168.0.3 127.

guest account = winname

log file = /var/log/samba/log.%m

#============================ Share Definitions ==============================

;[homes]

; comment = Home Directories

; browseable = no

; writeable = yes

[sos]

path = /sos

public = yes

writeable = yes

[htdocs]

path = /usr/local/www/htdocs

public = yes

writeable = yes

按“Ctrl+[”,存盘退出。

test# chown -R winname /sos

test# chown -R winname /usr/local/www/htdocs

ez-ipupdate的配置文件:qdns.conf

test# ee /usr/local/ez/qdns.conf

加入或更改如下内容:

service-type=qdns

user=user:passwd

host=test.8866.org

interface=tun0

max-interval=2073600

cache-file=/tmp/ez-ipupdate.cache

其余部分用“#”注释掉。按“Ctrl+[”,存盘退出。

配置ipfw

test# ee /etc/ipfw.conf

加入如下内容:(其中希网的DNS服务器的ip为202.108.36.139)

#ipfw防火墙规则的修正:(其中xxx.xxx.xxx.xxx和yyy.yyy.yyy.yyy是你所处地区的DNS服务器的IP)

# /etc/ipfw.conf

add 00100 allow ip from any to any via lo0

ad

||||||

d 00310 deny log ip from any to any ipopt rr

add 00320 deny log ip from any to any ipopt ts

add 00330 deny log ip from any to any ipopt ssrr

add 00340 deny log ip from any to any ipopt lsrr

add 00350 deny tcp from any to any in tcpflags syn,fin

add 00400 allow tcp from any to me 80 in

add 00500 check-state

add 00520 allow tcp from any to any out setup keep-state

add 00530 allow tcp from any to any out

# ICMP

add 00600 allow icmp from any to any icmptype 3

add 00610 allow icmp from any to any icmptype 4

add 00620 allow icmp from any to any out icmptype 8

add 00630 allow icmp from any to any in icmptype 0

add 00640 allow icmp from any to any in icmptype 11

# DNS

add 00700 allow ip from xxx.xxx.xxx.xxx to any

add 00710 allow ip from any to xxx.xxx.xxx.xxx

add 00720 allow ip from yyy.yyy.yyy.yyy to any

add 00730 allow ip from any to yyy.yyy.yyy.yyy

add 00740 allow ip from 202.108.36.139 to any

add 00750 allow ip from any to 202.108.36.139

add 00760 allow udp from any to any out

# LAN

add 00900 allow ip from 192.168.0.0/16 to any

add 00910 allow ip from any to 192.168.0.0/16

按“Ctrl+[”,存盘退出。

再配置rc.conf

还记得前面/etc/rc.conf中有:

#ipfw_enable="YES"

#ipfw_type="/etc/ipfw.conf"

吗?

test# ee /etc/rc.conf

去掉前面的“#”,按“Ctrl+[”,存盘退出。

至此,大功告成!

test# reboot

以root身份登入FreeBSD

运行samba

test# /usr/local/samba/sbin/smbd start

test# /usr/local/samba/sbin/nmbd start

运行mysql

test# cd /usr/local/mysql

test# ./bin/safe_mysqld --usr=mysql &

运行apache

test# /usr/local/www/bin/apachectl start

运行ez-ipupdate

test# /usr/local/ez/ez-ipupdate -c /usr/local/ez/qdns.conf

好了,如果没有什么异常,你的FreeBSD就正在运行着现在最流行的apache,mysql和samba。

2 Windows上

右键点击网上邻居,在菜单上选择属性,点击左键,打开后,右键点击本地连接,在菜单上选择属性,双击“Internet 协议

(TCP/IP)”,选择“使用下面的IP”,“IP地址(I)”处输入“192.168.0.3”,“子网掩码”处输入“255.255.255.0”,“默认网关”处输入

“192.168.0.1”;记得你在FreeBSD里记下的DNS服务器的IP吗?在“使用下面的DNS服务器地址”处输入它们,确定。好了,赶紧打开网上邻

居吧,看到FreeBSD里的sos和htdocs文件夹拉吧,你可以随意地在Windows和FreeBSD的这两个文件夹之间拷贝文件了。

打开MS-DOS,在根目录下输入:

C:\>ping 192.168.0.1

有回应,表示局域网配置正常。

C:\>ping test.8866.org

有回应,表示域名解析成功。

打开一个你常去的网站,这是通过FreeBSD作网关上去的。

打开记事本,输入:

hello,world! welcome to test.8866.org.

存为index.html,拷贝到网上邻居FreeBSD的htdocs内,打开IE,在地址栏输入:

http://test.8866.org

回车,看到那行字了吗?这就是你的首页。

再打开记事本,输入:

phpinfo();

?>

存为phpinfo.php,拷贝到网上邻居FreeBSD的htdocs内,在地址栏输入:

http://test.8866.org/phpinfo.php

回车,你会看到你的WEB服务器的信息。会有类似的一行:

This program makes use of the Zend Scripting Language Engine:

Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies with Zend Optimizer

v2.1.0, Copyright (c) 1998-2003, by Zend Technologies

配置调试用服务器

apache

安装在C:\www\apa

||||||

che下

httpd.conf中加入或改写:

LoadModule php4_module c:/php/sapi/php4apache.dll

LoadModule gzip_module modules/ApacheModuleGzip.dll

AddModule mod_php4.c

AddModule mod_gzip.c

ServerName localhost

AddType application/x-httpd-php .php

LogFormat "%h %l %u %t \"%r\" %>s %b mod_gzip: %{mod_gzip_compression_ratio}npct." common_with_mod_gzip_info1

LogFormat "%h %l %u %t \"%r\" %>s %b mod_gzip: %{mod_gzip_result}n In:%{mod_gzip_input_size}n

Out:%{mod_gzip_output_size}n:%{mod_gzip_compression_ratio}npct." common_with_mod_gzip_info2

CustomLog logs/access.log common_with_mod_gzip_info2

mod_gzip_on Yes

mod_gzip_minimum_file_size 300

mod_gzip_maximum_file_size 0

mod_gzip_maximum_inmem_size 100000

mod_gzip_keep_workfiles No

mod_gzip_dechunk Yes

mod_gzip_temp_dir "c:\www\apache\mod_gzip_tmp"

mod_gzip_item_include file \.html$

mod_gzip_item_include file \.htm$

mod_gzip_item_include file \.jsp$

mod_gzip_item_include file \.php$

mod_gzip_item_include file \.pl$

mod_gzip_item_include mime ^text/.*

mod_gzip_item_include mime ^application/x-httpd-php

mod_gzip_item_include handler ^perl-script$

mod_gzip_item_include handler ^server-status$

mod_gzip_item_include handler ^server-info$

mod_gzip_item_exclude file \.css$

mod_gzip_item_exclude file \.js$

mod_gzip_item_exclude mime ^image/.*

Mldule>

Window 2000下可以用“服务”方式启动apache

MS-DOS下,输入:

C:\>cd www\apache

C:\www\apache>apache -i -n "apache"

这样就把apache安裝到系统的服务中了,你可以在控制台的服务中看到apache列在服务列表內,以后开机时就自动执行apache了。

要启动apache也可以直接在MS-DOS下输入:net start apache,关闭apache输入:net stop apache

mod_gzip

将ApacheModuleGzip.dll拷贝至C:\www\apache\modules,创建c:\www\apache\mod_gzip_tmp即可。

php

将php解压缩到C:\www\apache\php

将php4ts.dll拷贝C:\windows\system

将php.ini-dist拷贝至C:\WINNT 目录下,并改名为 php.ini

修改php.ini:

register_globals = On

mysql.default_port = 3306

ZendOptimizer

执行ZendOptimizer*.exe

安装目录设为 C:\www\apache\Zend

安装程序将自动更新php.ini,并在其内容结尾处自动添加:

[Zend]

zend_optimizer.optimization_level=15

zend_extension_ts="C:\www\apache\Zend\lib\ZendOptimizer.dll"

mysql

运行setup,安装到C:\www\mysql下

将C:\www\mysql目录下的my-example.cnf文件改名为my.cnf拷贝到c:\目录下面

打开MS-DOS

C:\>write my.cnf

[mysqld]

port=3306

basedir = C:/www/mysql/

保存后退出。

设定mysql为“服务”方式启动:

MS-DOS下,输入:

C:\>cd apache\mysql\bin

C:\>apache\mysql\bin>mysqld-nt --install

以后开机时就自动执行mysql了,和apache一样,启动mysql时也可以在 DOS 下输入: net start

mysql关闭mysql时输入: net stop mysql

phpMyAdmin

将phpMyAdmin的zip文件解压缩到C:\www\apache\htdocs\localsql\和C:\www\apache\htdocs\serversql\目录下

编辑localsql内的Config.inc.php

$cfg['PmaAbsoluteUri'] = 'http://localhost/localsql/';

$cfg['Servers'][$i]['host'] = 'localhost'; // MySQL

||||||

hostname

$cfg['Servers'][$i]['port'] = '3306'; // MySQL port - leave blank for default port

$cfg['Servers'][$i]['socket'] = ''; // Path to the socket - leave blank for default socket

$cfg['Servers'][$i]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket')

$cfg['Servers'][$i]['compress'] = FALSE; // Use compressed protocol for the MySQL connection

// (requires PHP >= 4.3.0)

$cfg['Servers'][$i]['controluser'] = ''; // MySQL control user settings

// (this user must have read-only

$cfg['Servers'][$i]['controlpass'] = ''; // access to the "mysql/user"

// and "mysql/db" tables)

$cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?

$cfg['Servers'][$i]['user'] = 'root'; // MySQL user

$cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed

// with 'config' auth_type)

$cfg['Servers'][$i]['only_db'] = '';

编辑serversql内的Config.inc.php

$cfg['PmaAbsoluteUri'] = 'http://localhost/serversql/';

$cfg['Servers'][$i]['host'] = '192.168.0.1'; // MySQL hostname

$cfg['Servers'][$i]['port'] = '3306'; // MySQL port - leave blank for default port

$cfg['Servers'][$i]['socket'] = ''; // Path to the socket - leave blank for default socket

$cfg['Servers'][$i]['connect_type'] = 'tcp'; // How to connect to MySQL server ('tcp' or 'socket')

$cfg['Servers'][$i]['compress'] = FALSE; // Use compressed protocol for the MySQL connection

// (requires PHP >= 4.3.0)

$cfg['Servers'][$i]['controluser'] = ''; // MySQL control user settings

// (this user must have read-only

$cfg['Servers'][$i]['controlpass'] = ''; // access to the "mysql/user"

// and "mysql/db" tables)

$cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?

$cfg['Servers'][$i]['user'] = 'winname'; // MySQL user

$cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed

// with 'config' auth_type)

$cfg['Servers'][$i]['only_db'] = '';

这样,当Windows和FreeBSD上的apache和mysql运行着的时候,在Windows的IE地址栏中输入:

http://localhost/localsql/index.php

时,连入Windows上的mysql;

输入:

http://localhost/serversql/index.php

时,则连入FreeBSD上的mysql;

这样,你就可以同时管理调试用的和正式使用的两个数据库了。

至此,你完成了组网的基本过程。当然,根据你的实际情况重新编译内核是必要的,在这里不再累数。

可算完了,不好意思,还有几句废话:

1 个人使用的带宽少的可怜,就不要一边运行服务器,一边在Windows上看在线电影,打在线游戏和长时间下载了,当然你要是Money充足,拉

个百兆专线,我强烈建议你做以上所有事情,否则就白瞎了,呵呵。

2 一般的PC与好的专业服务器的性能是没法比的,再者即使你有最好的专业服务器,没有带宽也是白搭。

3 带宽垄断终究是不会长久的,现在日本的个人家庭ADSL的传输速率是:12Mbps/1Mbps,上行1Mbps达不到我想800kbps还是能达到的,包月费

折合人民币不到280元,未来的趋势可见一斑。

4 作服务器的PC,建议使用:

P4 CPU

Maxtor ATA133 Disk

选择主板要注意:

FSB与内存总线的搭配

南北桥总线的传输率

支持ATA133

当然,你要做IDE的RAID就更象服务器了。

5 以上为个人体会与借鉴他人体会的总结,难免有不妥之处,请不吝指正。

6 转载请注明E-mail和名字。

cheentong@up369.com

cheentong from HarBin

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
>>返回首页<<
推荐阅读
 
 
频道精选
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
© 2005- 王朝网络 版权所有