安装 SSL 后 Apache 无法启动

安装 SSL 后 Apache 无法启动

我最近从 GoDaddy 购买了 SSL 证书并将其安装在 Ubuntu 18.04.1 LTS 上,当我启用我的网站时,apache 无法启动,当我禁用该网站时,它可以正常工作。

当我重新启动时它显示:

有关详细信息,请参阅“systemctl status apache2.service”和“journalctl -xe”。

error.log 说

[Thu Jan 10 08:30:52.262743 2019] [core:info] [pid 11697] AH00096: removed PID file /var/run/apache2/apache2.pid (pid=11697)
[Thu Jan 10 08:30:52.262778 2019] [mpm_prefork:notice] [pid 11697] AH00169: caught SIGTERM, shutting down
[Thu Jan 10 08:30:52.322647 2019] [ssl:info] [pid 11757] AH01887: Init: Initializing (virtual) servers for SSL
AH00016: Configuration Failed
[Thu Jan 10 08:30:59.345931 2019] [ssl:info] [pid 11799] AH01887: Init: Initializing (virtual) servers for SSL
[Thu Jan 10 08:30:59.347452 2019] [ssl:info] [pid 11799] AH01876: mod_ssl/2.4.29 compiled against Server: Apache/2.4.29, Library: OpenSSL/1.1.0g
[Thu Jan 10 08:30:59.372953 2019] [socache_shmcb:debug] [pid 11805] mod_socache_shmcb.c(401): AH00821: shmcb_init allocated 512000 bytes of shared memory
[Thu Jan 10 08:30:59.372962 2019] [socache_shmcb:debug] [pid 11805] mod_socache_shmcb.c(417): AH00822: for 511912 bytes (512000 including header), recommending 32 subcaches, 88 indexes each
[Thu Jan 10 08:30:59.372965 2019] [socache_shmcb:debug] [pid 11805] mod_socache_shmcb.c(450): AH00824: shmcb_init_memory choices follow
[Thu Jan 10 08:30:59.372967 2019] [socache_shmcb:debug] [pid 11805] mod_socache_shmcb.c(452): AH00825: subcache_num = 32
[Thu Jan 10 08:30:59.372969 2019] [socache_shmcb:debug] [pid 11805] mod_socache_shmcb.c(454): AH00826: subcache_size = 15992
[Thu Jan 10 08:30:59.372972 2019] [socache_shmcb:debug] [pid 11805] mod_socache_shmcb.c(456): AH00827: subcache_data_offset = 2128
[Thu Jan 10 08:30:59.372974 2019] [socache_shmcb:debug] [pid 11805] mod_socache_shmcb.c(458): AH00828: subcache_data_size = 13864
[Thu Jan 10 08:30:59.372976 2019] [socache_shmcb:debug] [pid 11805] mod_socache_shmcb.c(460): AH00829: index_num = 88
[Thu Jan 10 08:30:59.373045 2019] [socache_shmcb:info] [pid 11805] AH00830: Shared memory socache initialised
[Thu Jan 10 08:30:59.373048 2019] [ssl:info] [pid 11805] AH01887: Init: Initializing (virtual) servers for SSL
[Thu Jan 10 08:30:59.374533 2019] [ssl:info] [pid 11805] AH01876: mod_ssl/2.4.29 compiled against Server: Apache/2.4.29, Library: OpenSSL/1.1.0g
[Thu Jan 10 08:30:59.374553 2019] [watchdog:debug] [pid 11805] mod_watchdog.c(454): AH010033: Watchdog: Running with WatchdogInterval 1000ms
[Thu Jan 10 08:30:59.374557 2019] [watchdog:debug] [pid 11805] mod_watchdog.c(462): AH02974: Watchdog: found parent providers.
[Thu Jan 10 08:30:59.374560 2019] [watchdog:debug] [pid 11805] mod_watchdog.c(508): AH02977: Watchdog: found child providers.
[Thu Jan 10 08:30:59.374563 2019] [watchdog:debug] [pid 11805] mod_watchdog.c(516): AH02978: Watchdog: Looking for child (_singleton_).
[Thu Jan 10 08:30:59.374565 2019] [watchdog:debug] [pid 11805] mod_watchdog.c(516): AH02978: Watchdog: Looking for child (_default_).
[Thu Jan 10 08:30:59.376195 2019] [watchdog:debug] [pid 11809] mod_watchdog.c(565): AH02980: Watchdog: nothing configured?
[Thu Jan 10 08:30:59.376847 2019] [watchdog:debug] [pid 11810] mod_watchdog.c(565): AH02980: Watchdog: nothing configured?
[Thu Jan 10 08:30:59.377929 2019] [watchdog:debug] [pid 11813] mod_watchdog.c(565): AH02980: Watchdog: nothing configured?
[Thu Jan 10 08:30:59.378492 2019] [mpm_prefork:notice] [pid 11805] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 configured -- resuming normal operations
[Thu Jan 10 08:30:59.378507 2019] [mpm_prefork:info] [pid 11805] AH00164: Server built: 2018-10-10T18:59:25
[Thu Jan 10 08:30:59.378513 2019] [core:notice] [pid 11805] AH00094: Command line: '/usr/sbin/apache2'
[Thu Jan 10 08:30:59.378516 2019] [core:debug] [pid 11805] log.c(1570): AH02639: Using SO_REUSEPORT: yes (1)
[Thu Jan 10 08:30:59.378526 2019] [mpm_prefork:debug] [pid 11805] prefork.c(923): AH00165: Accept mutex: sysvsem (default: sysvsem)
[Thu Jan 10 08:30:59.378714 2019] [watchdog:debug] [pid 11815] mod_watchdog.c(565): AH02980: Watchdog: nothing configured?
[Thu Jan 10 08:30:59.379264 2019] [watchdog:debug] [pid 11816] mod_watchdog.c(565): AH02980: Watchdog: nothing configured?
[Thu Jan 10 08:31:05.386866 2019] [watchdog:debug] [pid 11817] mod_watchdog.c(565): AH02980: Watchdog: nothing configured?
[Thu Jan 10 08:31:09.392196 2019] [watchdog:debug] [pid 11818] mod_watchdog.c(565): AH02980: Watchdog: nothing configured?
[Thu Jan 10 08:31:12.393937 2019] [watchdog:debug] [pid 11830] mod_watchdog.c(565): AH02980: Watchdog: nothing configured?
[Thu Jan 10 08:31:12.434633 2019] [core:info] [pid 11805] AH00096: removed PID file /var/run/apache2/apache2.pid (pid=11805)
[Thu Jan 10 08:31:12.434663 2019] [mpm_prefork:notice] [pid 11805] AH00169: caught SIGTERM, shutting down

apache2ctl configtest 语法正确

我的网站配置文件(我已将主机更改为 mydomain.com),

<IfModule mod_ssl.c>
    <VirtualHost _default_:443>
        ServerAdmin [email protected]
            ServerName mydomain.com
            DocumentRoot /var/www

    <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

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

        ErrorLog ${APACHE_LOG_DIR}/mydomain.com_ssl_error.log

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

        CustomLog ${APACHE_LOG_DIR}/mydomain.com_ssl_access.log combined

        Alias /doc/ "/usr/share/doc/"
        <Directory "/usr/share/doc/">
                Options Indexes MultiViews FollowSymLinks
                AllowOverride None
                Order deny,allow
                Deny from all
                Allow from 127.0.0.0/255.0.0.0 ::1/128
        </Directory>


        SSLEngine on

        SSLCertificateFile    /home/ubuntu/ssl_mydomain.com.crt
                SSLCertificateKeyFile /home/ubuntu/ssl_mydomain.com.key
        SSLCertificateChainFile /home/ubuntu/ssl_mydomain.com_chain.crt

        <FilesMatch "\.(cgi|shtml|phtml|php)$">
                SSLOptions +StdEnvVars
        </FilesMatch>
        <Directory /usr/lib/cgi-bin>
                SSLOptions +StdEnvVars
        </Directory>

        BrowserMatch "MSIE [2-6]" \
                nokeepalive ssl-unclean-shutdown \
                downgrade-1.0 force-response-1.0
        # MSIE 7 and newer should be able to use keepalive
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

    </VirtualHost>
</IfModule>

证书文件的路径是正确的,我已经仔细检查过了。

PS:另一台主机的相同conf文件在同一台服务器上运行良好。

相关内容