EDU511 国际专业IT教育服务门户
设为首页   加入收藏    联系我们
寻找IT教育内容合作伙伴
招聘教育网络编辑和运营门户高手
中讯IT教育2008年改版上线
寻找地方站运营伙伴QQ:59955917
中讯IT 技术成就未来
   你现在的位置:首页 >> 新闻系统 >> 操作系统 >> FreeBSD >> FreeBSD基础教程 >> 正文

FreeBSD网站平台建设全过程 第三步

 
 
日期:08-05-14 07:53:21 点击: 来源:中讯IT职业教育
 

第三步:安装配置web服务器

  注意:在进行这步操作前建议把squid关掉,因为在进行主页更新测试时squid的cache会使更新后的主页不能及时反映出来!

  为了不使用squid,除了关掉squid外,还要删除ipfw的透明代理端口转发语句:

# cd /usr/local/etc/rc.d
# ./squid.sh stop
# mv squid.sh squid.sh.bak
# ipfw del 500 fwd 127.0.0.1,3128 tcp from 192.168.0.0/24 to any 80

  本web服务器的其本组成为:

Apache 1.3.27
modssl
mod_php4
mod_gzip
mod_fastcgi
mod_perl
mysql3.23

  为了简化安装过程并发挥FreeBSD安装软件的优势,本文后续部分将采用ports安装。Ports 使在FreeBSD下安装各种软件变得很轻松。

  首先安装ports:(如果已经有/usr/ports目录则证明已经安装过了)

# /stand/sysinstall

  选Configure—Distributions—ports,ports将被安装在/usr/ports目录中。

  下面安装apache1.3.27 + modssl :

# cd /usr/ports/www/apache13-modssl
# make install

  系统会自动下载安装包并安装完毕。

  安装后系统会自动产生启动脚本apache.sh,在/usr/local/etc/rc.d目录中。可以通过运行apache.sh start|stop来启动或停止apache。

  安装mysql3.23:

# cd /usr/ports/databases/mysql323-server
# make install

  安装后产生启动脚本/usr/local/etc/rc.d/mysql-server.sh

  安装apache模块mod_php4:

# cd /usr/ports/www/mod_php4

  首先编辑scripts目录下的configure.php文件,加入对OpenSSL的支持

# vi scripts/configure.php

  找到下面一句

OpenSSL "OpenSSL support" ON \

  改成

OpenSSL "OpenSSL support" YES \

# make install

  出现对话框时直接选ok继续

  安装完成后编辑apache的配制文件/usr/local/etc/apache/httpd.conf ,添加如下内容:

# 设置默认可以使用的主页名称,这句系统一般已经有了,不用添加了
DirectoryIndex index.php index.html

# 这2句需要手工添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

安装其他Apache常用模块 mod_gzip + mod_fastcgi + mod_perl:

# cd /usr/ports/www/mod_gzip
# make install

# cd /usr/ports/www/mod_fastcgi
# make install

  编辑/usr/local/etc/apache/httpd.conf文件

  添加下面一句

AddHandler fastcgi-script fcgi fcgi fpl

# cd /usr/ports/www/mod_perl
# make install

  重新启动让所有软件自动运行。

  测试:

  首先以root身份执行线程察看命令top,列表中应该有下面几个线程正在运行:

PID USERNAME PRI NICE SIZE RES STATE COMMAND
69 root 2 0 440K 296K select natd     # 网络地址转换进程
132 root 2 0 3692K 3052K select httpd   # apache进程
166 mysql 2 0 27480K 4824K poll mysqld  # mysql进程

  在浏览器地址栏输入http://192.168.0.1 ,如果显示apache的欢迎页面,证明web服务器安装成功!web页面文件存放在/usr/local/www/data目录中,你可以把自己的网页拷贝到这个目录,就可以访问自己的主页了!

  键入命令:

# mysql

  出现下面显示证明mysql安装成功!

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 3.23.52

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

  键入exit退出mysql。

  为mysql的root用户设置一个口令123456

# mysqladmin -u root password '123456'

  现在我们来安装一个支持php+mysql的论坛。到http://www.faeryboard.com/showthread.php?s=&threadid=2429去下载完美版的仙境论坛程序。将下载的rar压缩包解开,然后使用ftp上传到/home/ylf/app目录。

  事先备份web服务器演示页面

# cd /usr/local/www/data
# mkdir backup
# mv * backup

  将论坛程序拷贝到/usr/local/www/data目录

# cd /home/ylf/app/vbb2.3.0final
# cp –r * /usr/local/www/data

  编辑论坛配置文件:

# vi /usr/local/www/data/admin/config.php

  内容如下:

<?php^M
^M
/////////////////////////////////////////////////////////////^M
// Please note that if you get any errors when connecting, //^M
// that you will need to email your host as we cannot tell //^M
// you what your specific values are supposed to be     //^M
/////////////////////////////////////////////////////////////^M
^M
// type of database running^M
// (only mysql is supported at the moment)^M
$dbservertype='mysql';^M               #数据库类型
^M
// hostname or ip of server^M
$servername='localhost';^M              #主机名
^M
// username and password to log onto db server^M
$dbusername='root';^M                #登录数据库用户
$dbpassword='123456';^M               #密码
^M
// name of database^M
$dbname='fin230';^M                 #论坛所使用的数据库名称
^M
// technical email address - any error messages will be emailed here^M
$technicalemail='webmaster@yoursite.com';^M    #管理信息
^M
// use persistant connections to the database^M
// 0 = don't use^M
// 1 = use^M
$usepconnect=1;^M
^M
?>

  除了root用户的密码需要添入外,其他部分可以不改。

  保存后,在浏览器地址栏输入http://192.168.0.1/admin/install.php ,根据提示一步步安装即可。
安装成功后,在在浏览器地址栏输入http://192.168.0.1 ,就可以看到论坛了!怎么样,挺漂亮吧!关于论坛的其他问题,请仔细看论坛安装包里面的说明文档,或者到仙境论坛的主页,那里有仙境论坛的

 
责任编辑:
 
前一篇:
后一篇:
登录模块加载中...
热点操作系统技术
友情链接
重庆之窗 | 博学教育网 | 重庆IT教育 | 我爱论文网 | 涪陵课件园 | 中国教育导航 | 洪波物理教育 | 第一教育网 | 考试培训 | 职业培训
地址:重庆渝中区大坪正街88号 Copyright © edu511.com All rights reserved.
本站建设得到北京泰胜得风险投资机构、重庆网通信息港、平全教育服务中心与的大力支持            重庆视网科技发展有限公司版权所有 邮编:400041
电话:023-61630611 15902314551            ICP备案号:渝ICP备08002346号 QQ:59955917       邮箱:sysium_yuh@126.com yuhong@edu511.com