Apache config syntax failing in Elastic Beanstalk - apache

I'm having problems deploying in Elastic Beanstalk (Tomcat).
When I deploy my WAR, an Apache config syntax check is done:
/usr/sbin/apachectl -t -f /var/elasticbeanstalk/staging/httpd/conf/httpd.conf
But it fails because that httpd.conf doesn't define modules needed:
Syntax error on line 214 of /etc/httpd/conf.d/ssl.conf
Invalid command 'SetEnvIf', perhaps misspelled or defined...
That modules, in this case, setenvif_moduleis defined in /etc/httpd/conf/httpd.confthat is my httpd config file.
I don't know where /var/elasticbeanstalk/staging/httpd/conf/httpd.confcomes from.
Any idea of how to solve this?

From my investigation, this seems only related to an initial instance install/build using Elastic Beanstalk. The ssl.conf file in question actually comes from the initial Apache install and is not part of the Elastic Beanstalk configuration.
The issue is happening because AWS no longer installs mod_setenvif.so as a module in httpd.conf and therefore this error is being thrown.
In order to remove this ongoing issue from my builds and due to the fact that I already customize my Apache configuration, I copied a working AWS httpd.conf file from another instance and added the mod_setenvif.so module to it. Using the directions at http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-tomcat-platform.html#java-tomcat-proxy-apache, Elastic Beanstalk configuration scripts use the new httpd.conf file and the error is no longer thrown.
I consider this a workaround answer since the main scripts is controlled by AWS. It my be a defect in the script or it may not. Regardless, I just wanted to find a solution quickly.

Related

How do you disable "/controlpanel" directory redirect to :2083 in WHM?

I've used WHM and cpanel for years but recently noticed that after an update the "/controlpanel" directory has been automatically added allowing domain.com/controlpanel to redirect to domain.com:2083
How do you disable this redirect that is public facing?
The /controlpanel and /securecontrolpanel are controlled by ScriptAliasMatch in httpd.conf which cannot by modified directly as WHM/cPanel will rebuild it again as it where before the manual modifications. So it will be better if modifications done through one of the following options:
SSH access is needed to apply any one of these
Modify the yaml file which used in the rebuild apache configuration process, the file can be found under /var/cpanel/conf/apache/local or /var/cpanel/conf/apache/main then rebuild apache configuration by running /scripts/rebuildhttpdconf then restart apache by running /usr/local/cpanel/scripts/restartsrv_httpd
Modify the template file which used to parse the previous yaml file in order to generate the configuration file. First copy this file /var/cpanel/templates/apache2_4/ea4_main.default to /var/cpanel/templates/apache2_4/ea4_main.local then start modifying it then rebuild and restart apache.
And my vote goes to the first option to keep it clean and simple as possible but it worth knowing both ways so you can extend the functionality as much as you can.
For more details:
Apache Global Configuration docs
Apache Custom Templates docs

WAMP Server 3.0.0 cannot open apache conf file

I've re-installed WAMP in order to put it into a different directory. This was mainly so everything is automatically backed up.
Mysql starts ok, but apache fails with the following message from the event viewer:
The Apache service named reported the following error:
httpd.exe: Could not open configuration file bin/conf/httpd.conf: The system cannot find the path specified. .
This file is in the correct place (C:\googledrive\wamp64\bin\apache\apache2.4.17\conf) and there isn't any other stray httpd.conf files that it might be picking up on the path or anywhere.
Any ideas?
This turned out to be a permissions problem. It seems that the system account didn't have access to the directory containing the config file, but I guess must have had enough access to start up Apache and give that helpful (not) message!

Puppet removes Foreman VirtualHosts when installing OpenStack

My introduction to Puppet and Foreman has been very painful, but I know there's a big community around it, so I'm hoping that someone can set me straight here.
I set up Foreman and Puppet using the Foreman-Installer and it went great. I had Foreman up and running and it worked great! However, I added the OpenStack controller role to the machine, it wiped out the Apache vhosts for Foreman. I've scoured Google and Github for copies of the vhost files, but with no luck.
So the main questions here:
1) How do I locate/generate the Foreman vhosts for Apache?
2) How do I prevent Puppet from removing them again?
Thanks in advance all you Puppet Masters!
To prevent Puppet from blasting your Apache config, start managing that config through Puppet.
I'm not sure how your OpenStack controller role works, but it likely employs the puppetlabs-apache module, which will purge unmanaged configuration. You should use this module to configure the Foreman vhost on the machine.
As for getting it back - Puppet should have stored the contents of deleted files in the clientbucket. Check the logs on that machine. There should be md5 sums for all removed files. Use those to retrieve the contents, either through the filebucket tool, or by manually trudging /var/lib/puppet/clientbucket (or whatever puppet agent --configprint clientbucketdir yields).

Apache Following Old Symbolic Link After Updating The Link

I have apache pointing to a symbolic link for a website. I'm using capistrano to deploy the code so it updates the symbolic link to point to the new release
After capistrano updates the symbolic link to the new release directory apache uses the previous release directory.
The weird thing is it doesn't happen all the time. After a deploy everything either works fine or apache follows the previous link until i restart or reload apache.
any ideas?
This may depend on Apache httpd holding a handle on the old symlink. As long as that is the case the old data (symlink) is not thrown away in Unix based filesystems.
It seems you are unable to predict whether this is the case. Maybe use of lsof can help. What could also help is to trigger a graceful restart of httpd.

Apache: I want to enable SSI. Can anyone furnish an example config file?

Yes - Google abounds with information about configuring Apache to support SSI.
But unfortunately, I still cannot seem to get it right.
My questions:
Can anyone furnish me a full-fledged example config file that enables SSI on an Apache server?
Also can you please tell me where I should drop this config file (i.e. which
directory)?
Apache probably wouldn't run if you didn't already have a fully-fledged config file. Try an
apachectl configtest
and see what happens.
My site is hosted at 110mb.com.
Interestingly enough, here is the solution:
Rename all files which have server-side includes to *.shtml.