【发布时间】:2014-02-04 16:43:32
【问题描述】:
我在笔记本电脑上运行 ubuntu 作为测试服务器。我正在尝试使用自签名 ssl 证书设置一些测试站点。我认为除了 apache 2 conf 文件之外,我的一切都是正确的。
在创建证书时,我将通用名称命名为 *.hr4.mdev。 “mdev”是我随意称呼的本地开发环境。
所以我修改了我现有的 conf 文件以在 443 上而不是在 80(第 1 行)上侦听,并添加了第 6、7 和 8 行。
<VirtualHost *:443>
ServerAdmin myemail@mydomain.com
ServerName marino.hr4.mdev
ServerAlias *.marino.hr4.mdev
DocumentRoot /var/www/marino.hr4/htdocs
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
<Directory /var/www/marino.hr4/htdocs>
php_value include_path /var/www/marino.hr4/htdocs
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/www/marino.hr4/logs/error.log
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel debug
CustomLog /var/www/marino.hr4/logs/access.log combined
</VirtualHost>
现在,当我访问该站点 (https://marino.hr4.mdev) 时,我被告知“它有效!”这在一定程度上令人放心,但这不是我期望看到的内容。
引用了 tremor 的链接后,我的 conf 文件现在如下所示:
<VirtualHost 192.168.73.128:443>
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
ServerAdmin bernard@theminery.com
ServerName marino.hr4.mdev
ServerAlias *.marino.hr4.mdev
DocumentRoot /var/www/marino.hr4/htdocs
<Directory /var/www/marino.hr4/htdocs>
php_value include_path /var/www/marino.hr4/htdocs
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/www/marino.hr4/logs/error.log
# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
LogLevel debug
CustomLog /var/www/marino.hr4/logs/access.log combined
</VirtualHost>
重新启动 Apache 后,我被要求添加一个安全异常,这很好,但随后我被踢到了我在我的机器上设置的另一个站点。
【问题讨论】:
-
只需将您的虚拟主机设置为默认主机,“It works”就是默认的 apache 目录。