粤ICP备11076303号  广州青年志愿者协会医疗服务总队 www.gzyld.org.cn
加入医疗队
加入志愿者

位置:GZ医疗队公益纪实公益站长网络技术

FreeBSD6.1入门级Web服务器配置手记(3)


来源:落伍者      作者:HarbinBeer      点击:次      时间:2007-06-18

apache随系统启动


QUOTE:
# ee /etc/rc.conf




[Copy to clipboard] [ - ]CODE:
apache22_enable="YES"

启动apache


QUOTE:
# /usr/local/etc/rc.d/apache22.sh start

安装php


QUOTE:
# cd /usr/ports/lang/php5
# make install clean ; rehash

安装过程中,选择apache,取消ipv6

安装php扩展


[Copy to clipboard] [ - ]CODE:
# cd /usr/ports/lang/php5-extensions
# make install clean ; rehash

选择
CALENDAR
CTYPE
GD
ICONV
MBSTRING
MYSQL
PCRE
SESSION
SOCKETS
ZIP
ZLIB

配置php


QUOTE:
# cd /usr/local/etc
# cp php.ini-recommended php.ini
# ee php.ini




[Copy to clipboard] [ - ]CODE:
; 基于安全考虑,禁用某些功能,根据自己情况修改
disable_functions = passthru, exec, phpinfo, system, ini_alter, readlink, symlink, leak, proc_open, popepassthru, chroot, scandir, chgrp, chown, escapeshellcmd, escapeshellarg, shell_exec, proc_get_status

配置apache

具体选项参考http://lamp.linux.gov.cn/Apache/ApacheMenu/index.html


QUOTE:
# ee /usr/local/etc/apache22/httpd.conf




[Copy to clipboard] [ - ]CODE:
DocumentRoot "/usr/www" # 网站主目录
<Directory "/usr/www"> # 网站主目录
Options FollowSymLinks
<IfModule dir_module>
DirectoryIndex index.html index.php index.htm
</IfModule>
<IfModule mime_module>
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</IfModule>
AddDefaultCharset GB2312
ServerTokens Prod
ServerSignature Email
<IfModule prefork.c> # 优化针对BSD的网络支持
StartServers 10
MinSpareServers 10
MaxSpareServers 15
ServerLimit 2000
MaxClients 1500
MaxRequestsPerChild 10000
</IfModule>

安装ZendOptimizer

ZendOptimizer属于商业软件,所以不能通过ports编译安装,只能下载安装


QUOTE:
# ln -s /lib/libm.so.3 /lib/libm.so.2
# mount /cdrom
# cp -R /cdrom/Zend /usr/ports/devel/Zend
# cd /usr/ports/devel/zend
# ./install

一路默认

安装phpmyadmin

也可以通过传统方式,通过ftp下载/上传到机器上,配置好参数即可运行。


QUOTE:
# cd /usr/ports/databases/phpmyadmin
# make install clean ; rehash

默认选项


QUOTE:
# cp -R /usr/local/www/phpMyAdmin /usr/www/phpMyAdmin
# cd /usr/www/phpMyAdmin
# cp ./libraries/config.default.php config.inc.php
# ee config.inc.php




[Copy to clipboard] [ - ]CODE:
$cfg['PmaAbsoluteUri'] = 'http://192.168.163.130/phpMyAdmin/' # 设置phpMyAdmin的绝对地址
$cfg['blowfish_secret'] = 'host'; # 设置cookie加密
$cfg['Servers'][$i]['auth_type'] = 'cookie' # 设置认证方式




QUOTE:
# chmod 755 config.inc.php

FTP设置

配置ftp(系统自带)


QUOTE:
# ee /etc/inetd.conf




[Copy to clipboard] [ - ]CODE:
ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l -h




QUOTE:
# ee /etc/rc.conf




[Copy to clipboard] [ - ]CODE:
inetd_enable="YES"

启动ftp


QUOTE:
# killall -HUP inetd

添加ftp用户组


QUOTE:
# pw groupadd ftpgroup -g 10001

添加ftp用户


QUOTE:
# adduser
Username:ftp
Full name:
Uid (Leave empty for default):1001
Login group [ftpuser]: ftpgroup
Login group is ftpgrou. Invite ftpuser into other groups? []:
Login class [default]:
Shell (sh csh tcsh zsh nologin) [sh]:
Home directory [/home/ftpuser]:/usr/www
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a random password? (yes/no) [no]:
Enter password:
Enter password again:
Lock out the account after creation? [no]:
Username : ftpuser
Password : *****
Full Name :
Uid : 1001
Class :
Groups : ftpgroup
Home : /usr/www
Shell : /bin/sh
Locked : no
OK? (yes/no) : yes
adduser: INFO: Successfully added (ftpuser) to the user database.
Add another user? (yes/no): no
Goodbye!

禁止匿名用户登录


QUOTE:
# ee /etc/ftpusers




[Copy to clipboard] [ - ]CODE:
anonymous
@guest

设定用户使用目录


QUOTE:
# ee /etc/ftpchroot




[Copy to clipboard] [ - ]CODE:
ftpusr /usr/www

设置用户磁盘限额
新活动 回顶部
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
验证码: 点击我更换图片
最新评论 进入详细评论页>>