2016-08-16 133 views
0

我试图在Ubuntu上设置Apache(2.4)服务器。现在我只是试图让它从/var/www/html提供静态页面(尽管最终我想运行一个WSGI Python应用程序)。Ubuntu上的Apache ERR_CONNECTION_REFUSED通过Ubuntu上的SSL

这是我的sites-available/website.conf文件:

<VirtualHost *:443> 
     ServerAdmin [email protected] 
     ServerName website.com:443 
     SSLEngine on 
     SSLCertificateFile /root/website.csr 
     SSLCertificateKeyFile /root/website.key 
     DocumentRoot /var/www/html 
     <Directory /> 
       Options FollowSymLinks 
       AllowOverride None 
     </Directory> 
     <Directory /var/www/> 
       Options Indexes FollowSymLinks MultiViews 
       AllowOverride None 
       Order allow,deny 
       allow from all 
     </Directory> 
     ErrorLog ${APACHE_LOG_DIR}/error.log 
     CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost> 

当我尝试要么去我的域名或服务器的IP连接到这个(与“网站”取代了我的实际域) Chrome给我ERR_CONNECTION_REFUSED(“无法访问此网站”)。

我也通过telnet尝试:

[email protected]:/etc/apache2# telnet localhost 443 
Trying ::1... 
Trying 127.0.0.1... 
telnet: Unable to connect to remote host: Connection refused 

当我注释掉所有行做从我的配置文件SSL,我可以连接通过telnet,而Chrome给我ERR_SSL_PROTOCOL_ERROR(“本网站可以”提供一个安全的连接“,我想这很有意义)。

这也是我ports.config,如果这能帮助:

Listen 80 

<IfModule ssl_module> 
     Listen 443 
     NameVirtualHost *:443 
</IfModule> 

<IfModule mod_gnutls.c> 
     Listen 443 
</IfModule> 

(是的,SSL模块使能)。

而且我经常看到类似的问题所引用的我的apache2.conf的一部分:

<Directory /> 
     Options FollowSymLinks 
     AllowOverride None 
     Require all denied 
</Directory> 

<Directory /usr/share> 
     AllowOverride None 
     Require all granted 
</Directory> 

<Directory /var/www/> 
     Options Indexes FollowSymLinks 
     AllowOverride None 
     Require all granted 
</Directory> 

这是我第一次建立一个Apache服务器,所以我猜我在这里弄乱了一些简单的东西?

+0

你可以尝试改变'听443'到'听443 https'(尽管HTTPS应该是默认端口443) –

回答

0

检查SSL模式在这里被激活:

须藤a2enmod SSL

须藤服务的Apache2重启

+0

'模块SSL已经启用“,问题依然存在。 –

1

我的问题在这里:

SSLEngine on 
SSLCertificateFile /root/website.csr 
SSLCertificateKeyFile /root/website.key 

我被链接到.csr,不是.crt。我也没有链接到中间的东西。

这里是它的现在,其中固定它:

SSLEngine on 
SSLCertificateFile /root/domain.crt 
SSLCertificateKeyFile /root/domain.key 
SSLCertificateChainFile /root/DigiCertCA.crt