-1

I'm currently trying to create a page with apache2 on a Debian stretch to host an app but when I a2ensite the HTTP version it just doesn't work, and when I enable the ssl one the entire server stops working, even the pages not related to that one page. Both conf files are fine, I'm stuck, any idea what could be wrong?

EDIT: Logs show this, at 09:06:37 I a2ensite, and stops working, at 09:07:01 I a2dissite and it works again:

[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'

EDIT: Both .Conf files content:

<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

The SSL one:

<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>
JMoreno
  • 1
  • 3
  • Without showing your configuration and/or logfiles, that will be tough to debug... Also you will need to define "doesn't work"more precisely: the server does not start at all? start but does not return any content ? returns unexpected content or errors like HTTP 500 or TLS handshake errors ? etc. – Patrick Mevzek Jul 12 '18 at 17:06
  • When I a2ensite it all the sites on the servers prompt "Server closed the connection unexpectedly", thanks for answering, I hope this will suffice. – JMoreno Jul 13 '18 at 07:12
  • No it does not (suffice). How are we supposed to know what is in your configuration files? – Patrick Mevzek Jul 14 '18 at 20:54
  • Added the configuration files, sorry! – JMoreno Jul 16 '18 at 07:31
  • Did you try `apachectl configtest` ? There is no SSL related directives in your `:443` VirtualHost so this is a little strange. What are you trying to do exactly? – Patrick Mevzek Jul 24 '18 at 06:11
  • Sorry for the delay answering! I tried that command and the result was `Syntax OK`. I'm trying to enable a CRM (Vtiger) on a php 5.6 version VM, I enabled it well on a php 7.0 VM but a plugin the company needed didn't work properly on php7, so they asked me to install the CRM on the 5.6 VM and then all this happened. – JMoreno Jul 26 '18 at 07:21

1 Answers1

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
Pankaj Kumar
  • 105
  • 1
  • 2
  • 15