电脑技术学习

FreeBSD 6.2-BETA2 WebServer架设总结

dn001

  #cd ../

  #mkdir wwwroot

  #cd wwwroot

  #ee index.php

  输入:

  <?php

  echo "Vhost.stuhack.com";

  ?>

  //wwwroot 为vhost.stuhack.com

  #ee /usr/local/etc/apache22/extra/httpd-vhosts.conf

  //按照下面的改成自己的

NameVirtualHost 125.208.15.11:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost 125.208.15.11:80>
  ServerAdmin stuceo@stuhack.com
  DocumentRoot /usr/local/www/apache22/data/htdocs
  ServerName Unix.stuhack.com
  <Directory "/usr/local/www/apache22/data/htdocs">
  allow from all
  Options +Indexes
  </Directory>
</VirtualHost>
<VirtualHost 125.208.15.11:80>
  ServerAdmin stuceo@stuhack.com
  DocumentRoot /usr/local/www/apache22/data/wwwroot
  ServerName vhost.stuhack.com
  <Directory "/usr/local/www/apache22/data/wwwroot">
  allow from all
  Options +Indexes
  </Directory>
</VirtualHost>
#apachectl restart

  //重起Apache服务器生效

  //ok 打开 http://unix.stuhack.com/

  //会显示 Unix.stuhack.com

标签: