FreeBSD 6.2快速架设网站服务器教程
5.安装 MySQL
使用如下指令
# cd /usr/ports/databases/mysql50-server
# make install clean
# cd /usr/ports/databases/php5-mysql
# make install clean
6. Apache2.2.X 基本设定
安装完 Apache 后,我们必须先进行一些基本设定才可以开始使用。本节中,我们先介绍较常使用的设定项目,让您可以快速的设定好网页服务器,而更详细的 Apache 设定将于下一小节中说明。Apache 的设定档位于:
/usr/local/etc/apache22/httpd.conf、/usr/local/etc/apache22/extra/httpd-languages.conf、/usr/local/etc/apache22/extra/httpd-default.conf。
设定/usr/local/etc/apache22/httpd.conf
ServerAdmin 设定管理者邮件
设定您的信箱,这个信箱地址当网页出现错误讯息时将出现在该页面上。以下范例为默认值:
ServerAdmin you@example.com
ServerName 设定主机名称及端口号
ServerName 可以让您设定您的主机名称,如果您没有主机名称,可以设定为您机器所使用的 IP。ServerName 会被用来重新转向网址,例如,当您输入一个网址 「http://www.example.com/dir」时,Apache 会参考您在 ServerName 中的设定,将 www.example.com 改成 ServerName,并在您所输入的网址后加上一个斜线「/」以连到 dir 目录中,也就是将网址转向到「http://www.example.com/dir/」。如果您的网址设定不正确,则使用者可能会连到一个不存在的地址。
所以,如果您没有主机名称,可以将这个值设定为 IP,让网址转向后还是可以连到正确的地方。在 ServerName 的设定中,我们也指定了 HTTP 的连接埠 80。
ServerName www.example.com:80
DocumentRoot 设定网页根目录
DocumentRoot 可以让我们指定网页根目录的位置,也就是我们存放网页的目录。
DocumentRoot "/usr/local/www/apache22/data"
设定好 DocumentRoot 后,我们必须要再设定该目录的权限。在 DocumentRoot 之后,有下列区段:(<DIRECTORY—< Directory>中间有些#掉的注释)
Options Indexes FollowSymLinks 注解这项
#Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
您必须将 也改成您的网页根目录位置。
DirectoryIndex 指定预设网页档名
DirectoryIndex index.html index.htm index.php index.php3 index.cgi index.pl
当使用者使用网址「http://www.example.com/dir」连到一个目录中时,如果没有指定网页,Apache 会去查找 DirectoryIndex 中所设定的网页在不在,如果存在则秀出预设的网页。 收藏:http://www.pc51.net/system/unix/freebsd/2008-02-29/a10189.html










文章评论
共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面