带有 SSL 的 apache 虚拟主机配置

带有 SSL 的 apache 虚拟主机配置

今天晚上我只想在我的 debian lenny 网络服务器上安装 phpmyadmin,但在摆弄了 ssl 并尝试了数百种我能想到的不同组合以使服务器重新运行之后,我却一无所获。我想不出我做了什么更改会导致虚拟主机不再工作,但现在服务器上托管的所有网站都无法访问。这是我尝试重新启动 apache 后得到的结果:

**After running /etc/init.d/apache2 restart
Restarting web server: apache2[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:80     has no VirtualHosts
[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:443 has no VirtualHosts
[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:0 has no VirtualHosts
[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:443 has no VirtualHosts
[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:0 has no VirtualHosts
[Sat Aug 18 19:59:02 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
 failed!

其中一个站点可用文件如下所示:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName  www.site.us
    ServerAlias site.us

    # Indexes + Directory Root
    DirectoryIndex index.html index.php
    DocumentRoot /var/www/site.us/

    #CGI Directory
    ScriptAlias /cgi-bin/ /var/www/site.us/cgi-bin/
    <Location /cgi-bin>
            Options +ExecCGI
    </Location>

    #Log Files
    ErrorLog /var/www/site.us/logs/error.log
    CustomLog /var/www/site.us/logs/access.log combined

</VirtualHost>

如果有人对检查某件事有任何建议,请告诉我,因为我现在不知所措

编辑 这是运行的结果:/etc/apache2 tail -f /var/www/site.us/logs/error.log

jcmo:/etc/apache2# tail -f /var/www/site.us/logs/error.log
[Sat Aug 18 12:48:34 2012] [error] [client 69.69.247.18] File does not exist: /var/www/site.us/Register/images, referer: http://site.us/Register/regusr.php
[Sat Aug 18 12:48:34 2012] [error] [client 69.69.247.18] File does not exist: /var/www/site.us/Register/images, referer: http://site.us/Register/regusr.php
[Sat Aug 18 12:48:34 2012] [error] [client 69.69.247.18] File does not exist: /var/www/site.us/Register/images, referer: http://site.us/Register/regusr.php
[Sat Aug 18 12:48:34 2012] [error] [client 69.69.247.18] File does not exist: /var/www/site.us/Register/images, referer: http://site.us/Register/regusr.php
[Sat Aug 18 12:48:34 2012] [error] [client 69.69.247.18] File does not exist: /var/www/site.us/Register/images, referer: http://site.us/Register/regusr.php
[Sat Aug 18 13:56:29 2012] [error] [client 183.60.213.24] File does not exist: /var/www/site.us/bannerStyle.css
[Sat Aug 18 15:22:39 2012] [error] [client 69.69.247.18] File does not exist: /var/www/site.us/TooTip.js, referer: http://site.us/myStuff.php
[Sat Aug 18 15:22:40 2012] [error] [client 69.69.247.18] File does not exist: /var/www/site.us/TooTip.js, referer: http://site.us/myStuff.php
[Sat Aug 18 15:25:51 2012] [error] [client 69.69.247.18] File does not exist: /var/www/site.us/TooTip.js, referer: http://site.us/myStuff.php
[Sat Aug 18 15:25:51 2012] [error] [client 69.69.247.18] File does not exist: /var/www/site.us/TooTip.js, referer: http://site.us/myStuff.php

答案1

确保你的站点链接到 sites-enabled 目录。Apache 仅包含sites-enabled

有一个方便的命令可以启用站点:

a2ensite site.com

另请参阅man a2ensite

您可能还想看看/etc/apache2/ports.conf。此文件定义了监听端口,并且可能还为部分/所有端口启用了命名虚拟主机。

相关内容