Apache2 命名虚拟本地主机?

Apache2 命名虚拟本地主机?,apache2,Apache2,我有一个本地apache2网站,如果我有: <VirtualHost *:80> ServerName localhost ... </VirtualHost> <VirtualHost *:443> ServerName localhost 但它不起作用 编辑: 我使用linux(kubuntu) 编辑2: 我也试着 <VirtualHost *:80> ServerName example.com ... </Virtual

我有一个本地apache2网站,如果我有:

<VirtualHost *:80>
  ServerName localhost
...
</VirtualHost>
<VirtualHost *:443>
  ServerName localhost
但它不起作用

编辑

我使用linux(kubuntu)

编辑2

我也试着

<VirtualHost *:80>
  ServerName example.com
...
</VirtualHost>
<VirtualHost *:443>
  ServerName example.com

重新启动我的应用程序和apache后,我希望
127.1.0.0
重新检测我的站点。当我实际将浏览器指向
127.1.0.0
时,它试图去某个地方,但无法到达。

您的操作系统(LINUX或WINDOWS)是什么?您必须对ssl进行单独的配置,并使用文件default-ssl.conf进行配置,然后将该文件包含在apache2.conf中,在某些情况下,您还必须在ssl证书生效之前创建它。祝你好运
<VirtualHost *:80>
  ServerName example.com
...
</VirtualHost>
<VirtualHost *:443>
  ServerName example.com
127.1.0.0    example.com