当我尝试访问时,我可以访问该网站,但我没有看到 https:// 中的“S”
我做了我的
apachectl 配置测试
apachectl 停止
apachectl 启动
a2ensite 默认-ssl.conf
a2ensite teampass.conf
/etc/init.d/apache2 重新启动
我在以下位置配置了我的虚拟主机/etc/apache2/sites-available/default-ssl.conf
:
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName teampass.domain.org
Serveralias www.teampass.domain.org
DocumentRoot /var/www/html/teampass
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCACertificateFile /etc/apache2/ssl/DigiCertCA
SSLCertificateFile /etc/apache2/ssl/star_domain_org
SSLCertificateKeyfile /etc/apache2/ssl/teampass.key
</VirtualHost>
这是我的 /etc/apache2/sites-available/teampass.conf
<VirtualHost *:80>
Redirect permanent / https://teampass.domain.org/
ServerAdmin webmaster@localhost
ServerName teampass.domain.org
ServerAlias www.teampass.domain.org
DocumentRoot /var/www/html/teampass
<Directory /var/www/html/teampass>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCACertificateFile /etc/apache2/ssl/DigiCertCA
SSLCertificateFile /etc/apache2/ssl/star_domain_org
SSLCertificateKeyfile /etc/apache2/ssl/teampass.key
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName teampass
ServerAlias www.teampass.domain.org
DocumentRoot /var/www/html/teampass
SSLCertificateFile /etc/apache2/ssl/star_domain_org
SSLCertificateKeyfile /etc/apache2/ssl/teampass.key
SSLCACertificateFile /etc/apache2/ssl/DigiCertCA
SSLEngine on
ErrorLog ${APACHE_LOG_DIR}/teampass_error.log
CustomLog ${APACHE_LOG_DIR}/teampass_access.log combined
<IfModule mod_rewrite.c>
# DO NOT REMOVE
RewriteOptions Inherit
</IfModule>
</VirtualHost>
这是我的 /etc/apache2/ports.conf
Listen 80
<IfModule ssl_module>
Listen 443 http
</IfModule>
<IfModule mod_gnutls.c>
listen 443 http
</IfModule>
答案1
在您的 port.conf 中更改
Listen 80
<IfModule ssl_module>
Listen 443 http
</IfModule>
<IfModule mod_gnutls.c>
listen 443 http
</IfModule>
经过
Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
默认 443 已经是https
如果你设置http
之后,它将http
在端口 443 上提供服务器内容
这是您需要的配置:
/etc/apache2/sites-available/default-ssl.conf:
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName teampass.domain.org
Serveralias www.teampass.domain.org
DocumentRoot /var/www/html/teampass
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCACertificateFile /etc/apache2/ssl/DigiCertCA
SSLCertificateFile /etc/apache2/ssl/star_domain_org
SSLCertificateKeyfile /etc/apache2/ssl/teampass.key
</VirtualHost>
/etc/apache2/sites-available/teampass.conf
<VirtualHost *:80>
Redirect permanent / https://teampass.domain.org/
ServerAdmin webmaster@localhost
ServerName teampass.domain.org
ServerAlias www.teampass.domain.org
DocumentRoot /var/www/html/teampass
<Directory /var/www/html/teampass>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName teampass
ServerAlias www.teampass.domain.org
DocumentRoot /var/www/html/teampass
SSLCertificateFile /etc/apache2/ssl/star_domain_org
SSLCertificateKeyfile /etc/apache2/ssl/teampass.key
SSLCACertificateFile /etc/apache2/ssl/DigiCertCA
SSLEngine on
ErrorLog ${APACHE_LOG_DIR}/teampass_error.log
CustomLog ${APACHE_LOG_DIR}/teampass_access.log combined
<IfModule mod_rewrite.c>
# DO NOT REMOVE
RewriteOptions Inherit
</IfModule>
</VirtualHost>