PDA

查看完整版本 : Linux RedHat系统下实现提供个人主页空间服务的方法


Tony
2003-10-22, 07:23 PM
在Linux中,可以用Apache 和 WU-FTPD 服务器通过一些简单设置,实现个人空间服务,Apache是web服务器,ftp提供主页上传功能。本文以RedHat 7.2 Linux为例,假设Apache 和 WU-FTPD服务器已经安装,具体配置方法如下:

  (1)安装RedHat 7.2 Linux时选择"服务器"或者定制安装服务器软件;
  (2)修改/etc/httpd/conf/httpd.conf文件中下面关于个人空间设置的一段。(//后是详细说明)
  UserDir public_html //此处修改默认目录,可修改,应该与下面的
  //相对应
  #
  # Control access to UserDir directories. The following is an example
  # for a site where these directories are restricted to read-only.
  #
  # //
  # AllowOverride FileInfo AuthConfig Limit
  # Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
  #
  # Order allow,deny
  # Allow from all
  #
  #
  # Order deny,allow
  # Deny from all
  #
  # //.....行之间的所有#去掉,使得个人主页用户的设置生效.并且""中的 "/home/*/public_html"是个人主页服务在Linux中存放位置的设置 *代表用户名生成的目录名。
  重新启动httpd服务:httpd stop / httpd start 或者httpd restart

  (3) 添加一个ftp用户的shell,使其不能使用命令,和telnet 和ssh服务编辑/etc/shells文件,在文件最后添加一行"/dev/null"的内容。
  (4)添加一个ftpchroot族,改组中的用户将已自己的home目录作为ftp根目录
groupadd ftpchroot
  (5)用户申请个人主页空间时,所用的用户名在Linux上要作为ftpchroot组的用户。以下操作以test用户为例:

  建立一个用户test ;密码:test

  usradd test -s /dev/null -g ftpchroot
  passwd test

  这样就在/home目录下自动产生一个test的目录。

  (6)进入test目录,建立个人主页发布目录public_html,然后进行权限设置

  cd /home/test
  mkdir public_html
  chmod 711 /home/test
  chmod 755 /home/test/public_html

  OK,现在只要将网页文件通过用用户名test密码为test,使用ftp上传到自己ftp目录下的public_html目录就可以启动自己的web服务了,系统默认为index.html文件。

  后记:如果服务器系统安装完整,在个人主页中可以支持PHP、JSP动态网页和MySQL PostGreSQL数据库。