首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在子域上添加HTTPS

无法在子域上添加HTTPS
EN

Server Fault用户
提问于 2018-04-02 21:55:34
回答 1查看 132关注 0票数 0

已经5天了,我都快疯了。

我正在尝试在我创建的子域上安装一个“让我们加密证书”,但是我无法让它正常工作。

以下是我在网站中的.conf文件:

代码语言:javascript
复制
test.com.conf


    ServerAdmin webmaster@localhost
    ServerName test.com
ServerAlias www.test.com
    DocumentRoot /var/www
    
        Options FollowSymLinks
        AllowOverride All
    
    
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    
        AllowOverride All
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.test.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,NE,R=permanent]

因此,这一个工作,我有一个test-le-ssl.conf创建的网站-可用。

这是我的whydoesntitwork.test.com.conf

代码语言:javascript
复制
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/whydoesntitwork
    
        Options FollowSymLinks
        AllowOverride All
    
    
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    
        AllowOverride All
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

当我运行./letsencrypt或add -d test.com -d whydoesntitwork.com时,它会问我是想续订还是尝试重新安装。我重新安装是因为我不想被锁在外面(他们说我们每周可以做5-7次)。

当我试图将SSL放在为什么工作时,我遇到的错误是:

代码语言:javascript
复制
The selected vhost would conflict with other HTTPS VirtualHosts within Apache. Please select another vhost or add ServerNames to your configuration.
VirtualHost not able to be selected.

我已经在/etc/apache2/hosts上添加了两个域,如下所示:

代码语言:javascript
复制
127.0.0.1 localhost.localdomain localhost
(myip)        test.com   test
(myip)        whydoesntitwork.test.com        whydoesntitwork

我做错什么了?

编辑:添加apache版本

代码语言:javascript
复制
Server version: Apache/2.2.22 (Debian)
Server built:   Sep 21 2017 20:51:54

谢谢

EN

回答 1

Server Fault用户

回答已采纳

发布于 2018-04-02 22:20:02

在Apache2.2上,您需要设置NameVirtualHost

代码语言:javascript
复制
NameVirtualHost *:80

另外,在第二个配置中,您似乎缺少了ServerName指令。

最后,您是否启用了站点中可用的配置?

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/905687

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档