apache2 on debian 9 gives wrong website

peter_jenp

New Member
Joined
Feb 23, 2021
Messages
21
Reaction score
5
Credits
222
hallo allemaal.
ik heb een probleem met een apache webserver.
ik heb op men server de volgende websites.
- www.jenp.net
- jenp.net
- hn.jenp--
- suport.jenp.net
- phpmyadmin.jenp.net
nu worden hm.jenp.net en www.jenp.net goed weer gegeven.
jenp.net gaat naar www.jenp.net en geeft daarmee ook de goede site weer.
maar phpmyadmin.jenp.net en suport.jenp.net gaan om de een of andere reden ook naar www.jenp.net
ipv datze de suport pagina en de phpmyadmin pagina weer geven.
wie kan me zeggen wat ik fout doe.
men site configuratsies zal ik hieronder plaatsen.

the configuration of: hn.jenp.net is:
Code:
<VirtualHost *:80>

<Directory /var/www/hn/>
    Options FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>
        ServerName hn.jenp.net
        ServerAlias *.hn.jenp.net
        ServerAdmin [email protected]
        DocumentRoot /var/www/hn
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

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

the configuration of: phpmyadmin.jenp.net is:
Code:
<VirtualHost *:80>
    DocumentRoot "/usr/share/phpmyadmin"
        ServerName phpmyadmin.jenp.net
    <Directory "/usr/share/phpmyadmin">
        allow from all
        Options None
        Require all granted
    </Directory>
</VirtualHost>

the ssl configuration of: suport.jenp.net is:
Code:
<IfModule mod_ssl.c>
    #   <VirtualHost _default_:443>

    <VirtualHost *:443>
        ServerAdmin [email protected]

        DocumentRoot /var/www/helpdesk

        <Directory /var/www/helpdesk>
            #    Options FollowSymLinks MultiViews
            #    AllowOverride all
            #    Order allow,deny
            #    allow from all
        </Directory>

        ServerName suport.jenp.net
        ServerAlias suport.jenp.net helpdesk.jenp.net *.suport.jenp.net *.helpdesk.jenp.net

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

        SSLEngine on
        SSLCertificateFile      /etc/ssl/wildcard/wildcard21.crt
        SSLCertificateKeyFile /etc/ssl/wildcard/www.jenp.net.key
        SSLCertificateChainFile /etc/ssl/wildcard/intermediar21.crt

        <FilesMatch "\.(cgi|shtml|phtml|php)$">

            SSLOptions +StdEnvVars
        </FilesMatch>

        <Directory /usr/lib/cgi-bin>

            SSLOptions +StdEnvVars
        </Directory>
        UseCanonicalName off
    </VirtualHost>
</IfModule>

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

the configuration of: jenp.net and www.jenp.net is:
Code:
<VirtualHost *:80>
<Directory /var/www/html/>
    Options FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>
        ServerName jenp.net
        ServerAlias www.jenp.net
        ServerAlias *.jenp.net
        ServerAdmin [email protected]
        DocumentRoot /var/www/html
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

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

the ssl configuration of: jenp.net and www.jenp.net is:
Code:
<IfModule mod_ssl.c>
#       <VirtualHost _default_:443>
<VirtualHost *:443>
                ServerAdmin [email protected]
                DocumentRoot /var/www/html
<Directory /var/www/html>
    Options FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

        ServerName jenp.net
        ServerAlias www.jenp.net
        ServerAlias *.jenp.net

                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined
                SSLEngine on
                SSLCertificateFile      /etc/ssl/wildcard/wildcard21.crt
                SSLCertificateKeyFile /etc/ssl/wildcard/www.jenp.net.key
                SSLCertificateChainFile /etc/ssl/wildcard/intermediar21.crt
                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>
        </VirtualHost>
</IfModule>

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

the s configuration of: suport.jenp.net is:
Code:
<VirtualHost *:80>
    <Directory /var/www/helpdesk/>
            Options FollowSymLinks MultiViews
            AllowOverride all
            Order allow,deny
            allow from all
    </Directory>
    ServerName suport.jenp.net
    ServerAlias suport.jenp.net helpdesk.jenp.net *.suport.jenp.net *.helpdesk.jenp.net
    ServerAdmin [email protected]
    DocumentRoot /var/www/helpdesk
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    UseCanonicalName off
</VirtualHost>

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

I hope someone can tell me what I'm doing wrong and how I can get it to work greetings: peter
 


f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,472
Reaction score
3,178
Credits
32,453
Share the output of the following.
Code:
apache2 -t -D DUMP_VHOSTS
 
OP
P

peter_jenp

New Member
Joined
Feb 23, 2021
Messages
21
Reaction score
5
Credits
222
I will do.
the autput of: apache2 -t -D DUMP_VHOSTS is:
Code:
[email protected]:~# apache2 -t -D DUMP_VHOSTS
[Thu Jan 20 15:06:52.333898 2022] [core:warn] [pid 11678] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot
[email protected]:~#
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,472
Reaction score
3,178
Credits
32,453
I expected more output but I think the problem is that phpmyadmin.jenp.net and suport.jenp.net only have a HTTP(port 80) configuration. Most browsers now days automatically redirect you to HTTPS(443) , since there is no HTTPS(443) configuration for the two mentioned the default HTTPS configuration(jenp.net) is served by apache when going to phpmyadmin.jenp.net and suport.jenp.net.
 
OP
P

peter_jenp

New Member
Joined
Feb 23, 2021
Messages
21
Reaction score
5
Credits
222
that would make sense if true. However, suport does have both ssl and no ssl unfortunately. while hn.jenp.net does not have ssl and works. the configuration of supor.jenp.net with ssl is:
Code:
<IfModule mod_ssl.c>
    #   <VirtualHost _default_:443>

    <VirtualHost *:443>
        ServerAdmin [email protected]

        DocumentRoot /var/www/helpdesk

        <Directory /var/www/helpdesk>
            #    Options FollowSymLinks MultiViews
            #    AllowOverride all
            #    Order allow,deny
            #    allow from all
        </Directory>

        ServerName suport.jenp.net
        ServerAlias suport.jenp.net helpdesk.jenp.net *.suport.jenp.net *.helpdesk.jenp.net

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

        SSLEngine on
        SSLCertificateFile      /etc/ssl/wildcard/wildcard21.crt
        SSLCertificateKeyFile /etc/ssl/wildcard/www.jenp.net.key
        SSLCertificateChainFile /etc/ssl/wildcard/intermediar21.crt

        <FilesMatch "\.(cgi|shtml|phtml|php)$">

            SSLOptions +StdEnvVars
        </FilesMatch>

        <Directory /usr/lib/cgi-bin>

            SSLOptions +StdEnvVars
        </Directory>
        UseCanonicalName off
    </VirtualHost>
</IfModule>

and from the suport page without ssl the config is:
Code:
<VirtualHost *:80>
    <Directory /var/www/helpdesk/>
            Options FollowSymLinks MultiViews
            AllowOverride all
            Order allow,deny
            allow from all
    </Directory>
    ServerName suport.jenp.net
    ServerAlias suport.jenp.net helpdesk.jenp.net *.suport.jenp.net *.helpdesk.jenp.net
    ServerAdmin [email protected]
    DocumentRoot /var/www/helpdesk
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    UseCanonicalName off
</VirtualHost>

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

anyway let's throw ourselves first at the support the phpmyadmin comt as far as i'm concerned later some time.
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,472
Reaction score
3,178
Credits
32,453
Code:
[email protected]:~# apache2 -t -D DUMP_VHOSTS
[Thu Jan 20 15:06:52.333898 2022] [core:warn] [pid 11678] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot
[email protected]:~#
Yeah I misread that it's lot of text to read through. Try setting this variable it's talking about for the APACHE_RUN_DIR and then try running it again because it should give a better overview of the virtualhosts.
 
OP
P

peter_jenp

New Member
Joined
Feb 23, 2021
Messages
21
Reaction score
5
Credits
222
Um I don't think I understand what you mean. I can find the following in the apache2.conf
Code:
# The directory where shm and other runtime files will be stored.
#

DefaultRuntimeDir ${APACHE_RUN_DIR}
but i don't understand what to change it to.
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,472
Reaction score
3,178
Credits
32,453
I don't normally use Debian myself, so I tried it out on my Debian vm. Run the following and share the output.
1. source /etc/apache2/envvars
2. apache2 -t -D DUMP_VHOSTS
 
OP
P

peter_jenp

New Member
Joined
Feb 23, 2021
Messages
21
Reaction score
5
Credits
222
I checked to see if I could get out.
but not quite yet therefore the contents of the envvars file
Code:
# envvars - default environment variables for apache2ctl

# this won't be correct after changing uid
unset HOME

# for supporting multiple apache2 instances
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
    SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
else
    SUFFIX=
fi

# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
# temporary state file location. This might be changed to /run in Wheezy+1
export APACHE_PID_FILE=/var/run/apache2$SUFFIX/apache2.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
# Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

## The locale used by some modules like mod_dav
export LANG=C
## Uncomment the following line to use the system default locale instead:
#. /etc/default/locale

export LANG

## The command to get the status for 'apache2ctl status'.
## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
#export APACHE_LYNX='www-browser -dump'

## If you need a higher file descriptor limit, uncomment and adjust the
## following line (default is 8192):
#APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'

## If you would like to pass arguments to the web server, add them below
## to the APACHE_ARGUMENTS environment.
#export APACHE_ARGUMENTS=''

## Enable the debug mode for maintainer scripts.
## This will produce a verbose output on package installations of web server modules and web application
## installations which interact with Apache
#export APACHE2_MAINTSCRIPT_DEBUG=1

also in the directory /etc/apache2 run the following command: apache2 -t -D DUMP_VHOSTS this hole in response back:

Code:
[email protected]:/etc/apache2# apache2 -t -D DUMP_VHOSTS
[Thu Jan 20 19:52:39.730236 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Thu Jan 20 19:52:39.730343 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Thu Jan 20 19:52:39.730369 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Thu Jan 20 19:52:39.730392 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.743649 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
[Thu Jan 20 19:52:39.743878 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744083 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744100 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744164 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744175 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744250 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744263 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744317 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744333 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744402 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744415 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00543: apache2: bad user name ${APACHE_RUN_USER}
[email protected]:/etc/apache2#
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,472
Reaction score
3,178
Credits
32,453
Code:
[email protected]:/etc/apache2# apache2 -t -D DUMP_VHOSTS
[Thu Jan 20 19:52:39.730236 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Thu Jan 20 19:52:39.730343 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Thu Jan 20 19:52:39.730369 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Thu Jan 20 19:52:39.730392 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.743649 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
[Thu Jan 20 19:52:39.743878 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744083 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744100 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744164 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744175 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744250 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744263 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744317 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744333 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744402 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 19:52:39.744415 2022] [core:warn] [pid 21459] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00543: apache2: bad user name ${APACHE_RUN_USER}
[email protected]:/etc/apache2#
All those variables it's complaining about are defined in /etc/apache2/envvars, you need to source that file and then run the command I mentioned before. I ran into the same when I didn't source the envars file, so do the following as I mentioned before.
1. source /etc/apache2/envvars
2. apache2 -t -D DUMP_VHOSTS
 
OP
P

peter_jenp

New Member
Joined
Feb 23, 2021
Messages
21
Reaction score
5
Credits
222
first of all thanks again for your response. I've been a bit cocky and haven't modified the envvars file. but have changed the rules in the suport.jenp.net.conf and so on. it contained a reference to the log with the variable and I changed that to the directory where the logs should be. and that it significantly reduced the number of errors. now apache2 -t -D DUMP_VHOSTS only gives the following 6 errors.
Code:
[email protected]:/etc/apache2#  apache2 -t -D DUMP_VHOSTS
[Thu Jan 20 20:44:44.041567 2022] [core:warn] [pid 24446] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Thu Jan 20 20:44:44.041638 2022] [core:warn] [pid 24446] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Thu Jan 20 20:44:44.041645 2022] [core:warn] [pid 24446] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Thu Jan 20 20:44:44.041654 2022] [core:warn] [pid 24446] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Thu Jan 20 20:44:44.054573 2022] [core:warn] [pid 24446] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
[Thu Jan 20 20:44:44.054799 2022] [core:warn] [pid 24446] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00543: apache2: bad user name ${APACHE_RUN_USER}

I conclude from this that there are still some errors with regard to the log file, but unfortunately I cannot determine which files are still wrong. I also understand that there are some problems with the username and group name. but again where is the error.
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,472
Reaction score
3,178
Credits
32,453
From my understanding of that file those are the default variables for apache which shouldn't be changed, however it looks like you only used the APACHE_LOG_DIR variable which isn't a problem since it's the general location of the log file. You used this.
Code:
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
However you would have made it easier on yourself if you created a seperate log file for each virtualhost since now all your virtual_hosts are logging to the same log file. So more like this.
Code:
ErrorLog ${APACHE_LOG_DIR}/support_error.log
CustomLog ${APACHE_LOG_DIR}/support_access.log combined
However I think you might have overwritten some of the other it is complaining too and those are really necessary. Let me show you the output of my test vm having used one of your virtualhosts.
[email protected]:~# source /etc/apache2/envvars
[email protected]:/root# apache2 -t -D DUMP_VHOSTS
AH00112: Warning: DocumentRoot [/var/www/helpdesk] does not exist
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80 is a NameVirtualHost
default server suport.jenp.net (/etc/apache2/conf-enabled/support.conf:1)
port 80 namevhost suport.jenp.net (/etc/apache2/conf-enabled/support.conf:1)
alias suport.jenp.net
alias helpdesk.jenp.net
wild alias *.suport.jenp.net
wild alias *.helpdesk.jenp.net
port 80 namevhost 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
If I have time later today I will try and copy all of your setup to my test vm to see if I can get the same problem as you.
 
Last edited:
OP
P

peter_jenp

New Member
Joined
Feb 23, 2021
Messages
21
Reaction score
5
Credits
222
first of all thank you very much for your response. I can possibly create an account on webmin that only has rights to all apache settings. I don't know if that's useful by any chance? and then give you the login details of the webmin environment via a private message. by the way, if I can't respond a little less or not in the next few days, it's due to side effects of the corona booster shot
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,472
Reaction score
3,178
Credits
32,453
I'm going to use the vhost configurations settings you posted here and configure those on my debian(11) test vm and will see if all of them work correctly and see what happens then which I will probably do tomorrow. I don't want any login details to anything, for one it's not smart to trust from a forum topic you met on a forum which such details and I have never managed a server through webmin or another web-interface.
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,472
Reaction score
3,178
Credits
32,453
I ran into the same problems as you, I changed a few things not sure which one it was that fixed it. Here are the things I changed:
1. I moved around the different vhost settings in a more logical order for each vhost so that it's more readable and less confusion when switching from reading one vhost to the next.
2. The vhosts with both a 80 and 443 definition I put into one file, same reason as point 1.
3. I removed a few unnecessary if's because apache was complaining about those.
4. I commented out old ways of granting access to directories and replaced them with the current way.
5. I replaced most of the phpmyadmin configuration with what is mentioned in the example: /etc/phpmyadmin/apache.conf which is also a symlink in /etc/apache2/conf-available/phpmyadmin.conf for when you use phpmyadmin without virtualhost using the /phpmyadmin as the location.
6. I added seperate log files for each vhost that way you it's easier debugging if one doesn't work correctly and for the same reason as point 1.
7. I replaced the certificate and key files with my local host's certificate and key files.
8. I replaced the domain names with a locally resolvable name so it was easier for me to test.

hn.conf
Code:
<VirtualHost *:80>
ServerName hn.feedmebits.nl
#ServerName hn.jenp.net
#ServerAlias *.hn.jenp.net
ServerAdmin [email protected]
ErrorLog ${APACHE_LOG_DIR}/hn_error.log
CustomLog ${APACHE_LOG_DIR}/hn_access.log combined

DocumentRoot /var/www/hn

<Directory /var/www/hn/>
Options FollowSymLinks MultiViews
AllowOverride All
Require all granted
#Order allow,deny
#allow from all
</Directory>
</VirtualHost>
jenp.conf
Code:
<VirtualHost *:80>
ServerName jenp.feedmebits.nl
#ServerName jenp.net
#ServerAlias www.jenp.net
#ServerAlias *.jenp.net
ServerAdmin [email protected]
ErrorLog ${APACHE_LOG_DIR}/jenp_error.log
CustomLog ${APACHE_LOG_DIR}/jenp_access.log combined

DocumentRoot /var/www/html

<Directory /var/www/html/>
Options FollowSymLinks MultiViews
AllowOverride All
Require all granted
#Order allow,deny
#allow from all
</Directory>
</VirtualHost>

#<IfModule mod_ssl.c>
#<VirtualHost _default_:443>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName jenp.feedmebits.nl
#ServerName jenp.net
#ServerAlias www.jenp.net
#ServerAlias *.jenp.net
ErrorLog ${APACHE_LOG_DIR}/jenp_error.log
CustomLog ${APACHE_LOG_DIR}/jenp_access.log combined
SSLEngine on
SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
#SSLCertificateChainFile /etc/ssl/wildcard/intermediar21.crt

DocumentRoot /var/www/html

<Directory /var/www/html>
Options FollowSymLinks MultiViews
AllowOverride All
Require all granted
#Order allow,deny
#allow from all
</Directory>

<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>

<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
</VirtualHost>
#</IfModule>
phpmyadmin.conf
Code:
<VirtualHost *:80>
ServerName phpmyadmin.feedmebits.nl
ErrorLog ${APACHE_LOG_DIR}/phpmyadmin_error.log
CustomLog ${APACHE_LOG_DIR}/phpmyadmin_access.log combined

DocumentRoot "/usr/share/phpmyadmin"

#<Directory "/usr/share/phpmyadmin">
##allow from all
#Options None
#Require all granted
#</Directory>
# phpMyAdmin default Apache configuration
Alias /phpmyadmin /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin>
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
Require all granted
# limit libapache2-mod-php to files and directories necessary by pma
<IfModule mod_php7.c>
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/usr/share/doc/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/:/usr/share/php/:/usr/share/javascript/
</IfModule>
</Directory>

# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/templates>
Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/libraries>
 Require all denied
</Directory>
</VirtualHost>
support.conf
Code:
<VirtualHost *:80>
ServerName support.feedmebits.nl
#ServerName suport.jenp.net
#ServerAlias suport.jenp.net helpdesk.jenp.net *.suport.jenp.net *.helpdesk.jenp.net
ServerAdmin [email protected]
ErrorLog ${APACHE_LOG_DIR}/support_error.log
CustomLog ${APACHE_LOG_DIR}/support_access.log combined
UseCanonicalName off

DocumentRoot /var/www/helpdesk

<Directory /var/www/helpdesk/>
Options FollowSymLinks MultiViews
AllowOverride all
Require all granted
#Order allow,deny
#allow from all
</Directory>
</VirtualHost>


#<IfModule mod_ssl.c>
#<VirtualHost _default_:443>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName support.feedmebits.nl
#ServerName suport.jenp.net
#ServerAlias suport.jenp.net helpdesk.jenp.net *.suport.jenp.net *.helpdesk.jenp.net
ErrorLog ${APACHE_LOG_DIR}/support_error.log
CustomLog ${APACHE_LOG_DIR}/support_access.log combined

SSLEngine on
SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
#SSLCertificateChainFile /etc/ssl/wildcard/intermediar21.crt

DocumentRoot /var/www/helpdesk

<Directory /var/www/helpdesk>
Options FollowSymLinks MultiViews
AllowOverride all
Require all granted
#Order allow,deny
#allow from all
</Directory>


<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>

<Directory /usr/lib/cgi-bin>
 SSLOptions +StdEnvVars
</Directory>
UseCanonicalName off
</VirtualHost>
#</IfModule>
I tested all of them using Debian 11 but it shoudn't be any different on Debian 9, all of them worked for me on the ports that you expect them to work. They should work for you as well if you copy/paste them. The only thing you should have to do is replace the certificate and key files, comment out my ServerNames and then uncomment your ServerNames and ServerAliases.
 
Last edited:
OP
P

peter_jenp

New Member
Joined
Feb 23, 2021
Messages
21
Reaction score
5
Credits
222
Unfortunately I have to say that it still doesn't work. When I try to start apache I get the error:
Code:
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.

with the command: systemctl status apache2.service I get the following:
Code:
[email protected]:/etc/apache2# systemctl status apache2.service
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2022-01-22 15:47:03 CET; 1min 40s ago
  Process: 22508 ExecStop=/usr/sbin/apachectl stop (code=exited, status=1/FAILURE)
  Process: 3085 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
  Process: 23016 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
 Main PID: 408 (code=exited, status=0/SUCCESS)

jan 22 15:46:58 h2922282.stratoserver.net apachectl[23016]: Action 'start' failed.
jan 22 15:46:58 h2922282.stratoserver.net apachectl[23016]: The Apache error log may have more information.
jan 22 15:46:57 h2922282.stratoserver.net systemd[1]: Starting The Apache HTTP Server...
jan 22 15:47:03 h2922282.stratoserver.net systemd[1]: apache2.service: Control process exited, code=exited status=1
jan 22 15:47:03 h2922282.stratoserver.net systemd[1]: Failed to start The Apache HTTP Server.
jan 22 15:47:03 h2922282.stratoserver.net systemd[1]: apache2.service: Unit entered failed state.
jan 22 15:47:03 h2922282.stratoserver.net systemd[1]: apache2.service: Failed with result 'exit-code'.
[email protected]:/etc/apache2#
en in de configs heb ik aleen feedmebits.nl veranders naar jenp.net.
en de ssl regels aan ge past naar:
SSLCertificateFile /etc/ssl/wildcard/wildcard21.crt
SSLCertificateKeyFile /etc/ssl/wildcard/www.jenp.net.key
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,472
Reaction score
3,178
Credits
32,453
Run the following and share the output.
Code:
apachectl configtest
 
OP
P

peter_jenp

New Member
Joined
Feb 23, 2021
Messages
21
Reaction score
5
Credits
222
I got an error message solved thanks to apachectl configtest this was in jenp.conf there was missing </VirtualHost> I added this and now the error is gone. I still get the following error when I run configtest
Code:
apache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Syntax error on line 32 of /etc/apache2/sites-enabled/suport.conf: </VirtualHost> without matching <VirtualHost> section
Action 'configtest' failed.
The Apache error log may have more information.

I have the feeling that here too there seems to be something wrong with : </VirtualHost> in the config of suport.conf that's why I also post as the suport.conf is with me now.
Code:
ServerAdmin [email protected]
ServerName support.jenp.net
#ServerName suport.jenp.net
#ServerAlias suport.jenp.net helpdesk.jenp.net *.suport.jenp.net *.helpdesk.jenp.net
ErrorLog ${APACHE_LOG_DIR}/support_error.log
CustomLog ${APACHE_LOG_DIR}/support_access.log combined

SSLEngine on
SSLCertificateFile      /etc/ssl/wildcard/wildcard21.crt
SSLCertificateKeyFile /etc/ssl/wildcard/www.jenp.net.key
#SSLCertificateChainFile /etc/ssl/wildcard/intermediar21.crt

DocumentRoot /var/www/helpdesk

<Directory /var/www/helpdesk>
Options FollowSymLinks MultiViews
AllowOverride all
Require all granted
#Order allow,deny
#allow from all
</Directory>

<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>

<Directory /usr/lib/cgi-bin>
 SSLOptions +StdEnvVars
</Directory>
UseCanonicalName off
</VirtualHost>
#</IfModule>
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
4,472
Reaction score
3,178
Credits
32,453
It should be this for the port 80 definition, you missed the opening <VirtualHost> tag for support.
Code:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName support.jenp.net
#ServerName suport.jenp.net
#ServerAlias suport.jenp.net helpdesk.jenp.net *.suport.jenp.net *.helpdesk.jenp.net
ErrorLog ${APACHE_LOG_DIR}/support_error.log
CustomLog ${APACHE_LOG_DIR}/support_access.log combined

SSLEngine on
SSLCertificateFile      /etc/ssl/wildcard/wildcard21.crt
SSLCertificateKeyFile /etc/ssl/wildcard/www.jenp.net.key
#SSLCertificateChainFile /etc/ssl/wildcard/intermediar21.crt

DocumentRoot /var/www/helpdesk

<Directory /var/www/helpdesk>
Options FollowSymLinks MultiViews
AllowOverride all
Require all granted
#Order allow,deny
#allow from all
</Directory>

<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>

<Directory /usr/lib/cgi-bin>
 SSLOptions +StdEnvVars
</Directory>
UseCanonicalName off
</VirtualHost>
#</IfModule>
Read my reply where I posted all the virtualhosts, I have it correct there. I tested all the virtualhosts I shared and they worked for me even the support one.
 
Last edited:
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Top