📄 1192.html
字号:
# this is an absolute path. So you may want to put<br>
# in a location where the owner can get to it.<br>
DocumentRoot /home/vhosts/domain1.com/www/<br>
<br>
# Since we will use PHP to create basically<br>
# all our file we put a directive to the Index file.<br>
DirectoryIndex index.php<br>
<br>
# Name of the server<br>
ServerName www.domain1.com<br>
<br>
# Log files Relative to ServerRoot option<br>
ErrorLog logs/domain1.com-error_log<br>
TransferLog logs/domain1.com-access_log<br>
RefererLog logs/domain1.com-referer_log<br>
AgentLog logs/domain1.com-agent_log<br>
<br>
# Use CGI scripts in this domain. In the next case you<br>
# can see that it does not have CGI scripts. Please<br>
# read up on the security issues relating to CGI-scripting.<br>
ScriptAlias /cgi-bin/ /var/www/cgi-bin/domain1.com/<br>
AddHandler cgi-script .cgi<br>
AddHandler cgi-script .pl<br>
<br>
<br>
# This is another domain. Note that you could host<br>
# multiple domains this way...<br>
<br>
<br>
# Mail to this address on errors<br>
ServerAdmin webmaster@domain2.com<br>
<br>
# Where documents are kept in the virtual domain<br>
DocumentRoot /virtual/domain2.com/www/html<br>
<br>
# Name of the server<br>
ServerName www.domain2.com<br>
<br>
# Log files Relative to ServerRoot option<br>
ErrorLog logs/domain2.com-error_log<br>
TransferLog logs/domain2.com-access_log<br>
RefererLog logs/domain2.com-referer_log<br>
AgentLog logs/domain2.com-agent_log<br>
<br>
# No CGI"s for this host<br>
<br>
# End: virtual host section<br>
<br>
<br>
使用上述例子在你的服务器上创建你自己的虚拟主机。如果你想从Apache网站上阅读每一条指令,它的网址是:http://www.apache.org。<br>
<br>
<br>
<br>
SSL虚拟主机<br>
<br>
<br>
创建SSL虚拟主机类似非SSL。除了你需要指定另外的指令,还有,你需要增加一个DNS记录并且修改 httpd.conf。这里有一个例子。<br>
<br>
#--------------------------------------------#<br>
# SSL Virtual Host Context<br>
#--------------------------------------------#<br>
<br>
<br>
# General setup for the virtual host<br>
DocumentRoot /usr/local/apache/htdocs<br>
ServerAdmin webmaster@securedomain1.com<br>
ServerName www.securedomain1.com<br>
ErrorLoglogs/domain1.com-error_log<br>
TransferLog logs/domain1.com-transfer_log<br>
<br>
# SSL Engine Switch:<br>
# Enable/Disable SSL for this virtual host.<br>
SSLEngine on<br>
<br>
# Server Certificate:<br>
# Point SSLCertificateFile at a PEM encoded certificate. If<br>
# the certificate is encrypted, then you will be prompted for a<br>
# pass phrase. Note that a kill -HUP will prompt again. A test<br>
# certificate can be generated with `make certificate" under<br>
# built time. Keep in mind that if you"ve both a RSA and a DSA<br>
# certificate you can configure both in parallel (to also allow<br>
# the use of DSA ciphers, etc.)<br>
# Note that I keep my certificate files located in a central<br>
# location. You could change this if you are an ISP, or ASP.<br>
<br>
SSLCertificateFile /usr/local/apache/conf/ssl.crt/server.crt<br>
<br>
# Server Private Key:<br>
# If the key is not combined with the certificate, use this<br>
# directive to point at the key file. Keep in mind that if<br>
# you"ve both a RSA and a DSA private key you can configure<br>
# both in parallel (to also allow the use of DSA ciphers, etc.)<br>
<br>
SSLCertificateKeyFile /usr/local/apache/conf/ssl.key/server.key<br>
<br>
<br>
# Per-Server Logging:<br>
# The home of a custom SSL log file. Use this when you want a<br>
# compact non-error SSL logfile on a virtual host basis.<br>
CustomLog /usr/local/apache/logs/ssl_request_log <br>
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x "%r" %b"<br>
<br>
<br>
记住你有很多指令可以指定。我们将在另一篇有关配置Apache的文章中讨论,本文只是一个入门性指南。<br>
<br>
生成证书<br>
<br>
这是如何生成证书的按部就班的描述。<br>
<br>
为你的Apache服务器创建一个RSA私用密钥(被Triple-DES加密并且进行PEM格式化):<br>
<br>
# openssl genrsa -des3 -out server.key 1024<br>
<br>
请在安全的地方备份这个server.key文件。记住你输入的通行短语(pass phrase)!你可以通过下面的命令看到这个RSA私用密钥的细节。<br>
<br>
# openssl rsa -noout -text -in server.key<br>
<br>
而且你可以为这个RSA私用密钥创建一个加密的PEM版本(不推荐),通过下列命令:<br>
<br>
# openssl rsa -in server.key -out server.key.unsecure<br>
<br>
用服务器RSA私用密钥生成一个证书签署请求(CSR-Certificate Signing Request)(输出将是PEM格式的):<br>
<br>
# openssl req -new -key server.key -out server.csr<br>
<br>
当OpenSSL提示你“CommonName”时,确保你输入了服务器的FQDN("Fully Qualified Domain Name") ,即,当你为一个以后用https://www.foo.dom/访问的网站生成一个CSR时,这里输入"www.foo.dom"。你可借助下列命令查看该CSR的细节:<br>
<br>
# openssl req -noout -text -in server.csr<br>
<br>
将CSR发到一个CA<br>
<br>
现在你必须发送该CSR到一个CA以便签署,然后的结果才是可以用于Apache的一个真正的证书。<br>
<br>
有两种选择:<br>
<br>
第一种,你可以通过一个商业性CA如Verisign 或 Thawte签署证书。那么你通常要将CSR贴入一个web表格,支付签署费用并等待签署的证书,然后你可以把它存在一个server.crt文件中。关于商业性CA的更多信息,请参见下列链接:<br>
<br>
Verisign - http://digitalid.verisign.com/server/apacheNotice.htm<br>
Thawte Consulting - http://www.thawte.com/certs/server/request.html<br>
CertiSign Certificadora Digital Ltda. - http://www.certisign.com.br<br>
IKS GmbH - http://www.iks-jena.de/produkte/ca/<br>
Uptime Commerce Ltd. - http://www.uptimecommerce.com<br>
BelSign NV/SA - http://www.belsign.be<br>
<br>
<br>
你自己的CA<br>
<br>
第二种,你可以利用自己的CA并由该CA签署CSR。你可以创建自己的认证中心来签署证书。最简单的方法是利用OpenSSL提供的CA.sh或 CA.pl脚本。比较复杂而且是手工的方法是:<br>
<br>
为你的CA创建一个RSA私用密钥( 被Triple-DES加密并且进行PEM格式化的):<br>
<br>
# openssl genrsa -des3 -out ca.key 1024<br>
<br>
请在安全的地方备份这个ca.key文件。记住你输入的通行短语(pass phrase)!你可以通过下面的命令看到这个RSA私用密钥的细节。<br>
<br>
# openssl rsa -noout -text -in ca.key<br>
<br>
而且你可以为这个RSA私用密钥创建一个加密的PEM版本(不推荐),通过下列命令:<br>
<br>
# openssl rsa -in ca.key -out ca.key.unsecure<br>
<br>
利用CA的RSA密钥创建一个自签署的CA证书(X509结构)(输出将是PEN格式的):<br>
<br>
# openssl req -new -x509 -days 365 -key ca.key -out ca.crt<br>
<br>
你可以通过下列命令查看该证书的细节:<br>
<br>
# openssl x509 -noout -text -in ca.crt<br>
<br>
准备一个签署所需的脚本,因为"openssl ca"命令有一些奇怪的要求而且缺省的OpenSSL配置不允许简单地直接使用"openssl ca"命令,所以一个名为sign.sh的脚本随mod_ssl分发一道发布(子目录pkg.contrib/)。 使用该脚本进行签署。<br>
<br>
现在你可以使这个CA签署服务器的CSR,以便创建用于Apache服务器内部的真正的SSL证书(假定你手头已经有一个server.csr):<br>
<br>
# ./sign.sh server.csr<br>
<br>
它签署服务器的CSR并且结果在一个server.crt文件中。<br>
<br>
现在你有两个文件:server.ket和server.crt。在你的Apache的httpd.conf文件中,如下使用它们:<br>
<br>
SSLCertificateFile /path/to/this/server.crt<br>
SSLCertificateKeyFile /path/to/this/server.key<br>
<br>
server.csr不再需要了。<br>
<br>
<br>
<br>
<br>
--------------------------------------------------------------------------------<br>
<br>
参考资源<br>
<br>
http://www.apache.org<br>
http://www.modssl.org<br>
http://www.openssl.org<br>
http://www.php.net<br>
http://www.mysql.com<br>
http://www.perl.com<br>
http://www.cpan.org<br>
<br>
原文:http://www.devshed.com/Server_Side/PHP/SoothinglySeamless/ <br>
</FONT><br>
</TD>
</TR>
<TR>
<TD colSpan=2><FONT
class=middlefont></FONT><BR>
<FONT
class=normalfont>全文结束</FONT> </TD>
</TR>
<TR>
<TD background="images/dot.gif" tppabs="http://www.linuxhero.com/docs/images/dot.gif" colSpan=2
height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
<TD vAlign=top width="20%"
background="images/line.gif" tppabs="http://www.linuxhero.com/docs/images/line.gif" rowSpan=2>
<DIV align=center>
<table class=tableoutline cellspacing=1 cellpadding=4
width="100%" align=center border=0>
<tr class=firstalt>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colspan=2 height=21>
<font class=normalfont><b>所有分类</b></font></td>
</tr>
<tr class=secondalt> <td noWrap width=27%> <font class=normalfont>1:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type1.html" tppabs="http://www.linuxhero.com/docs/type1.html">非技术类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>2:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type2.html" tppabs="http://www.linuxhero.com/docs/type2.html">基础知识</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>3:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type3.html" tppabs="http://www.linuxhero.com/docs/type3.html">指令大全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>4:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type4.html" tppabs="http://www.linuxhero.com/docs/type4.html">shell</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>5:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>6:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type6.html" tppabs="http://www.linuxhero.com/docs/type6.html">xwindow</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>7:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type7.html" tppabs="http://www.linuxhero.com/docs/type7.html">kde</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>8:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type8.html" tppabs="http://www.linuxhero.com/docs/type8.html">gnome</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>9:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type9.html" tppabs="http://www.linuxhero.com/docs/type9.html">输入法类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>10:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type10.html" tppabs="http://www.linuxhero.com/docs/type10.html">美化汉化</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>11:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>12:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type12.html" tppabs="http://www.linuxhero.com/docs/type12.html">存储备份</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>13:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type13.html" tppabs="http://www.linuxhero.com/docs/type13.html">杂项工具</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>14:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>15:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type15.html" tppabs="http://www.linuxhero.com/docs/type15.html">网络安全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>16:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type16.html" tppabs="http://www.linuxhero.com/docs/type16.html">内核技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>17:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type17.html" tppabs="http://www.linuxhero.com/docs/type17.html">速度优化</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>18:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type18.html" tppabs="http://www.linuxhero.com/docs/type18.html">apache</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>19:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type19.html" tppabs="http://www.linuxhero.com/docs/type19.html">email</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>20:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type20.html" tppabs="http://www.linuxhero.com/docs/type20.html">ftp服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>21:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>22:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type22.html" tppabs="http://www.linuxhero.com/docs/type22.html">代理服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>23:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type23.html" tppabs="http://www.linuxhero.com/docs/type23.html">samba</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>24:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type24.html" tppabs="http://www.linuxhero.com/docs/type24.html">域名服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>25:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type25.html" tppabs="http://www.linuxhero.com/docs/type25.html">网络过滤</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>26:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type26.html" tppabs="http://www.linuxhero.com/docs/type26.html">其他服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>27:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type27.html" tppabs="http://www.linuxhero.com/docs/type27.html">nfs</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>28:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type28.html" tppabs="http://www.linuxhero.com/docs/type28.html">oracle</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>29:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type29.html" tppabs="http://www.linuxhero.com/docs/type29.html">dhcp</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>30:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>31:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type31.html" tppabs="http://www.linuxhero.com/docs/type31.html">php</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>32:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type32.html" tppabs="http://www.linuxhero.com/docs/type32.html">ldap</a></font></td> </tr> </table></td></tr> </table>
</DIV></TD></TR>
<TR vAlign=top>
<TD width="80%">
<DIV align=center><BR>
</DIV>
</TD></TR></TBODY></TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#eeeeee
border=0><TBODY>
<TR>
<TD width="50%">
<P><FONT class=middlefont>版权所有 © 2004 <A
href="mailto:bjchenxu@sina.com">linux知识宝库</A><BR>
违者必究. </FONT></P>
</TD>
<TD width="50%">
<DIV align=right><FONT class=middlefont>Powered by: <A
href="mailto:bjchenxu@sina.com">Linux知识宝库</A> Version 0.9.0 </FONT></DIV>
</TD></TR></TBODY></TABLE>
<CENTER></CENTER></TD></TR>
</TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -