-1

我目前正在尝试apache2在 Debian 延伸上创建一个页面来托管应用程序,但是当我a2ensite使用 HTTP 版本时它就不起作用,当我启用该版本时ssl,整个服务器都停止工作,即使是与此无关的页面一页。两个 conf 文件都很好,我被卡住了,知道可能出了什么问题吗?

编辑:日志显示这一点,在 09:06:37 我 a2ensite,并停止工作,在 09:07:01 我 a2dissite 并且它再次工作:

[Fri Jul 13 09:06:37.059026 2018] [mpm_prefork:notice] [pid 20067] AH00171: 
Graceful restart requested, doing restart
[Fri Jul 13 09:06:37.245485 2018] [mpm_prefork:notice] [pid 20067] AH00163: 
Apache/2.4.10 (Debian) OpenSSL/1.0.1t configured -- resuming normal operations
[Fri Jul 13 09:06:37.245513 2018] [core:notice] [pid 20067] AH00094: Command 
line: '/usr/sbin/apache2'
[Fri Jul 13 09:07:01.050648 2018] [mpm_prefork:notice] [pid 20067] AH00171: 
Graceful restart requested, doing restart
[Fri Jul 13 09:07:01.171448 2018] [mpm_prefork:notice] [pid 20067] AH00163: 
Apache/2.4.10 (Debian) OpenSSL/1.0.1t configured -- resuming normal 
operations
[Fri Jul 13 09:07:01.171475 2018] [core:notice] [pid 20067] AH00094: Command 
line: '/usr/sbin/apache2'

编辑:两个 .Conf 文件内容:

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin (...)
DocumentRoot /var/www/html/(site)
ServerName (site)

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf

<Directory "/var/www/html/(site)">
  DirectoryIndex index.php
  AllowOverride All
  Order allow,deny
  Allow from all
  Require all granted
</Directory>

RewriteEngine on
RewriteCond %{SERVER_NAME} =(site)
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

SSL 之一:

<IfModule mod_ssl.c>
<VirtualHost *:443>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin (...)
DocumentRoot /var/www/html/(site)
ServerName (site)

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf

<Directory "/var/www/html/(site)">
  DirectoryIndex index.php
  AllowOverride All
  Order allow,deny
  Allow from all
  Require all granted
</Directory>


</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
</IfModule>
4

1 回答 1

0

1. disable site like: a2dissite default-ssl.conf
2. Restart apache like: service apache2 reload
3. Now enable site like: a2ensite default-ssl.conf 5 Restart apache again    like: service apache2 reload

于 2018-07-12T07:12:15.530 回答