您现在的位置: 无忧电子商务网 >> 信息学院 >> 程序开发 >> php >> 正文

超级服务器apache+mysql+php+ssl之完全安装攻略(2)

作者:佚名    信息学院来源:整理    点击数:    更新时间:2008-2-2 我要参与讨论

  $mysql_link);

$sql = "SELECT * FROM $dbtable";

$result = mysql_db_query($dbname,$sql);

?>

<table bgcolor="black">

<tr><td>

<table>

</td></tr>

</table>

</body>

</html>

注意,我们竟能在同一文件中同时有HTML和PHP命令。这就是PHP脚本的奇妙之处。

虚拟主机的设置

现在是设置Apache处理一些虚拟主机的时间了。由于Apache提供的灵活性,虚拟主机可很简单地做到。首先你需要一个DNS服务器把虚拟主机的域名指向web服务器的IP地址。在DNS使用一个CNAME记录把 your_virtual_domain.com指向服务器的IP。其次你需要修改Apache的配置文件httpd.conf以增加新的虚拟域名。记住,这只是一个很基本的例子,你有勇气读一下Apache的指令。

让我们看一个 httpd.conf 的例子。

httpd.conf 片断

#--------------------------------------------------------#

# VIRTUAL HOST SECTION NON-SSL

#--------------------------------------------------------#

# VirtualHost directive allows you to specify another virtual

# domain on your server. Most Apache options can be specified

# within this section.

# Mail to this address on errors

ServerAdmin webmaster@domain1.com

# Where documents are kept in the virtual domain

# this is an absolute path. So you may want to put

# in a location where the owner can get to it.

DocumentRoot /home/vhosts/domain1.com/www/

# Since we will use PHP to create basically

# all our file we put a directive to the Index file.

DirectoryIndex index.php

# Name of the server

ServerName www.domain1.com

# Log files Relative to ServerRoot option

ErrorLog logs/domain1.com-error_log

TransferLog logs/domain1.com-access_log

RefererLog logs/

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页

在google里搜索更多超级服务器apache+mysql+php+ssl之完全安装攻略(2)

Google
Web www.51ec.org
【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
我来说两句 对此文章发表了评论
  昵 称: *必填    ·注册用户·
  评 分: 1分 2分 3分 4分 5分     严禁发表危害国家安全、政治、黄色淫秽等内容的评论,用户需对自己在使用本网站服务过程中的行为承担法律责任。本站管理员有权保留或删除评论内容,评论内容只代表机友个人观点,与本网站立场无关。  
评 论
内 容

 
评论列表 (最新 评论仅限网友观点!)

供求信息




| 设为首页 | 加入收藏 | 关于我们 | 广告服务 | 联系方式 | 友情链接 | 版权申明