Apache URL映射

时间:2013-09-19 13:55:25

标签: apache ssl https

我为ssl设置了apache。 我可以浏览https://localhost

我想将https://localhosz更改为https://www.test.com或其他

我的httpd-ssl.conf:

SSLSessionCache "shmcb:C:/wamp/bin/apache/apache2.4.2/logsssl_scache(512000)"
SSLEngine on  
DocumentRoot "C:/wamp/www/TeamPass" 
ServerName localhos:443 
ErrorLog "C:/wamp/logs/mysecuresite_error_log" 
TransferLog "C:/wamp/logs/mysecuresite_access_log"
SSLCertificateFile "C:/wamp/OpenSSL/certs/webserver.cer" 
SSLCertificateKeyFile "C:/wamp/OpenSSL/certs/private.key"  

CustomLog "C:/wamp/logs/ssl_request_log" \ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

我如何更改配置文件以便apache启动,因为我尝试使用virtualhost进行一些配置,但是在更改完成后wamp将无法启动。 这是一个测试服务器,所以我没有DNS服务器,但编辑了我的主机文件。

我需要C:/ wamp / www / TeamPass来收听test.com:443,我可以将服务器名称更改为此网址,但我不确定这是否正确。 使用url https://pass.test.de需要做什么,我是否需要使用重写模块

2 个答案:

答案 0 :(得分:1)

对于MS Windows,您可以修改Apache安装路径中 conf / extra / 文件夹中的文件 httpd-vhosts.conf ,以包含下一个配置:

Listen 443
NameVirtualHost 127.0.0.1:443
<VirtualHost 127.0.0.1:443>
  ServerName www.test.com
  DocumentRoot "C:\wamp\www\TeamPass"
  <Directory "C:\wamp\www\TeamPass">
    AllowOverride All
    Allow from All
  </Directory>
  ErrorLog "C:\wamp\logs\mysecuresite_error_log"
  CustomLog "C:\wamp\logs\ssl_request_log" \ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
  SSLEngine on
  SSLCertificateFile "C:\wamp\OpenSSL\certs\webserver.cer" 
  SSLCertificateKeyFile "C:\wamp\OpenSSL\certs\private.key" 
</VirtualHost>

然后,在文件 C:\ WINDOWS \ system32 \ drivers \ etc \ hosts 中添加此行:

127.0.0.1   www.test.com

答案 1 :(得分:0)

将您的主机名更改为www.test.com

edit or run the file hostname and the file hosts

sudo gksu gedit /etc/hostname  and add www.test.com

sudo gksu gedit /etc/hosts and add the line 127.0.0.1 www.test.com localhost 

in the virtualhoste use www.test.com instead of localhost.