apache virtualhost语法有什么区别?

时间:2013-10-10 07:49:51

标签: apache ssl vhosts

我为两个具有不同语法的不同域设置了SSL vhost。这两个文件的语法是

file1:example.test.com.conf

<VirtualHost *:80>
DocumentRoot /var/www/example.org/htdocs
ServerName example.test.com
<Directory "/var/www/example.org/htdocs">
allow from all
Options -Indexes
</Directory>
</VirtualHost>

<VirtualHost *:443>
DocumentRoot /var/www/example.org/htdocs
ServerName example.test.com
<Directory "/var/www/example.org/htdocs">
allow from all
Options -Indexes
</Directory>
SSLEngine on
SSLCertificateFile /etc/ssl/ssl.crt/example_org.crt
SSLCertificateKeyFile /etc/ssl/ssl.key/example_org.key
</VirtualHost>

file2:example.dev.com.conf

<VirtualHost *:80>
DocumentRoot "/var/www/example.org/htdocs"
ServerName example.dev.com
<Directory "/var/www/example.org/htdocs">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

<VirtualHost *:443>
DocumentRoot "/var/www/example.org/htdocs"
ServerName example.dev.com
<Directory "/var/www/example.org/htdocs">
allow from all
Options +Indexes
</Directory>
SSLEngine on
SSLCertificateFile /etc/ssl/ssl.crt/STAR_dev_org.crt
SSLCertificateKeyFile /etc/ssl/ssl.key/dev.key
</VirtualHost>

这两个文件之间的区别是,

file1: DocumentRoot /var/www/example.org/htdocs
file2: DocumentRoot "/var/www/example.org/htdocs"

file1: Options -Indexes
flie2: Options +Indexes

file1: SSLCertificateFile /etc/ssl/ssl.crt/example_org.crt
flie2: SSLCertificateFile /etc/ssl/ssl.crt/STAR_dev_org.crt

file1: SSLCertificateKeyFile /etc/ssl/ssl.key/example_org.key
flie2: SSLCertificateKeyFile /etc/ssl/ssl.key/dev.key

设置完这些文件后,重启Apache服务器并运行两个域

1) http://www.example.test.com and https://www.example.test.com 
2) http://www.example.dev.com and https://www.example.dev.com

第一个域同时使用http和https,但第二个域在http。

中不起作用

配置文件创建是否有任何语法?请帮忙,谢谢!

0 个答案:

没有答案
相关问题