快速业务通道

apache+mysql+php+ssl服务器之完全安装攻略

作者 佚名技术 来源 NET编程 浏览 发布时间 2012-05-24
------------------------------------#
# 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

# 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

# Log files Relative to ServerRoot option
ErrorLog logs/domain1.com-error_log
TransferLog logs/domain1.com-access_log
RefererLog logs/domain1.com-referer_log
AgentLog logs/domain1.com-agent_log

# Use CGI scripts in this domain. In the next case you
# can see that it does not have CGI scripts. Please
# read up on the security issues relating to CGI-scripting.
ScriptAlias /cgi-bin/ /var/www/cgi-bin/domain1.com/
AddHandler cgi-script .cgi
AddHandler cgi-script .pl

# This is another domain. Note that you could host
# multiple domains this way...

# Mail to this address on errors
ServerAdmin

# Where documents are kept in the virtual domain
DocumentRoot /virtual/domain2.com/www/html

# Name of the server
ServerName

# Log files Relative to ServerRoot option
ErrorLog logs/domain2.com-error_log
TransferLog logs/domain2.com-access_log
RefererLog logs/domain2.com-referer_log
AgentLog logs/domain2.com-agent_log

# No CGI''s for this host

# End: virtual host section

使用上述例子在你的服务器上创建你自己的虚拟主机。如果你想从Apache网站上阅读每一条指令,它的网址是:。


SSL虚拟主机

创建SSL虚拟主机类似非SSL。除了你需要指定另外的指令,还有,你需要增加一个DNS记录并且修改 httpd.conf。这里有一个例子。

#--------------------------------------------#
# SSL Virtual Host Context
#--------------------------------------------#

# General setup for the virtual host
DocumentRoot /usr/local/apache/htdocs
ServerAdmin
ServerName
ErrorLoglogs/domain1.com-error_log
TransferLog logs/domain1.com-transfer_log

# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on

# Server Certificate:
# Point SSLCertificateFile at a PEM encoded certificate. If
# the certificate is encrypted, then you will be prompted for a
# pass phrase. Note that a kill -HUP will prompt again. A test
# certificate can be generated with `make certificate'' under
# built time. Keep in mind that if you''ve both a RSA and a DSA
# certificate you can configure both in parallel (to also allow
# the use of DSA ciphers, etc.)
# Note that I keep my certificate files located in a central
# location. You could change this if you are an ISP, or ASP.

SSLCertificateFile /usr/local/apache/conf/ssl.crt/server.crt

# Server Private Key:
# If the key is not combined with the certificate, use this
# directive to point at the key file. Keep in mind that if
# you''ve both a RSA and a DSA private key you can configure
# both in parallel (to also allow the use of DSA ciphers, etc.)

SSLCertificateKeyFil

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号