I am setting up an Apache 2.4.7 server on a Ubuntu 14.04.5 LTS machine, with the intention of replacing another instance. Basically, the new instance is a pristine Ubuntu 14.4 install, with only Apache installed. I have copied and pasted my entire /etc/apache2 folder from the old machine to the new one.
I am getting this error:
AH00111: Config variable ${PORTAL_SERVER} is not defined
There are other questions about this error, such as this one or this one. However, the solutions or answers leave me puzzled because on both machines:
- PORTAL_SERVER is defined in /etc/environment
echo $PORTAL_SERVER
gives me the expected valueprintenv
lists the environment variable with the expected value- the contents of /etc/apache2 is exactly the same, in particular, that of /etc/apache2/envvars.
Only, on the new machine, sudo apachectl -V
gives me an AH00111 error.
The service gets started, but obviously, not as I wanted it.
sudo apachectl graceful
gives me the same message, which feels normal. sudo service apache2 restart
does the same.
My question is why doesn't the apache user "see" the environment variable?
EDIT:
Here is the entire custom configuration (in a single conf file enabled in sites-enabled), where the ...
represent the multiple ProxyPass
directives that constitute the rest of the file. The standard Apache configuration files were not edited.
<VirtualHost *:443>
# This virtual host will answer requests on port 443 (https) for the domain defined hereafter
# NOTE: The PORTAL_SERVER environment variable is defined in /etc/environment.
ServerName ${PORTAL_SERVER}
# Define error page 503 (site under maintenance) : reached when a server doesn't answer ajp requests
DocumentRoot /var/www
Alias "/errors" "/var/www/errors"
<Directory "/var/www/errors/">
Options FollowSymLinks MultiViews
order deny,allow
allow from all
</Directory>
ErrorDocument 503 /errors/error-503.html
# Redirect https://${PORTAL_SERVER}/ on https://${PORTAL_SERVER}/portal/
Redirect /index.html https://${PORTAL_SERVER}/portal/
# Activate SSL and define certificat
SSLEngine on
SSLProtocol all
SSLCertificateFile /etc/ssl/certs/ssl_certificate.crt
SSLCertificateKeyFile /etc/ssl/private/ssl_server.key
SSLCertificateChainFile /etc/ssl/certs/IntermediateCA.crt
# Configure mod_proxy
ProxyRequests Off
ProxyPreserveHost Off
# Default timeout before ajp requests are considered as timed out
ProxyTimeout 10
...
...
</VirtualHost>