2017-08-09 177 views
1

我按照以下说明操作:virtual host,httpsapache 2.4虚拟主机给我带来“Index of /”

因为我用一个DynDNS的为我的LOCA托管webside,我最终000-default.conf看起来是这样的:

<VirtualHost *:443> 
       ServerName www.mydomain.dyndns.xx 
       ServerAdmin [email protected] 
       DocumentRoot /var/www/html/mydomain.dyndns.xx/ 
       ErrorLog ${APACHE_LOG_DIR}/error.log 
       CustomLog ${APACHE_LOG_DIR}/access.log combined 
       SSLEngine on 
       SSLCertificateFile /etc/apache2/ssl/ca.crt 
       SSLCertificateKeyFile /etc/apache2/ssl/ca.key 

       ErrorLog ${APACHE_LOG_DIR}/www.virtualhost1.com_error.log 
       CustomLog ${APACHE_LOG_DIR}/www.virtualhost1.com_access.log combined 
</VirtualHost> 

我additionaly在/etc/apache2/apache.conf配置的follwoing:

<Directory /var/www/html/mydomain.dyndns.xx> 
     Options Indexes FollowSymLinks 
     AllowOverride None 
     Require all granted 
</Directory> 

,并在/etx/host

127.0.0.1  localhost 
::1    localhost ip6-localhost ip6-loopback 
ff02::1   ip6-allnodes 
ff02::2   ip6-allrouters 

127.0.1.1  raspberrypi 

192.168.x.x  www.mydomain.dyndns.xx 

当我尝试打开它的页面URL描述了端口80上的“Indes of /”,当我敲击这些文件时,我得到http:// mydomain.dyndns.xx/mydomain.dyndns.xx.index.php

如果我打电话给https://,那么我的浏览器上会收到ERR_CONNECTION_REFUSED。

谢谢你的帮助!

回答

0

您的000-defualt.conf文件看起来完美的文件。虽然在使用SSL证书确保进行以下更改:

编辑PORTS.CONF FILE

编辑您的ports.conf文件,并添加以下行:

Listen 192.168.x.x:443 

这就告诉阿帕奇收听来自指定IP的传入连接:端口443

在本地主机上测试配置

你可以先通过将以下条目/etc/hosts文件来测试你的系统上的配置:

127.0.0.x www.mydomain.dyndns.xx 

并添加以下到ports.conf文件:

Listen 127.0.0.x:443 

确保注释掉192.168.x.x www.mydomain.dyndns.xx输入ports.conf文件,然后测试配置

ENABLE MOD_SS

sudo a2enmod ssl 

重新启动Apache

重新启动的Apache2:sudo systemctl restart apache2

在您的浏览器指向你的域名:https://www.mydomain.dyndns.xx

大号

通过发出以下命令启用mod_ssl