Lost Httpd.Conf File Located Apache

Lost httpd.conf file located apache

Get the path of running Apache

$ ps -ef | grep apache
apache 12846 14590 0 Oct20 ? 00:00:00 /usr/sbin/apache2

Append -V argument to the path

$ /usr/sbin/apache2 -V | grep SERVER_CONFIG_FILE
-D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"

Reference:

http://commanigy.com/blog/2011/6/8/finding-apache-configuration-file-httpd-conf-location

Missing LetsEncrypt httpd-prefix.conf File

The file you need is one of the standard Bitnami configuration files, described in their documentation:

The httpd-prefix.conf file ships the default configuration for the
applications in “prefix” mode, such that the application can be accessed
at (for example) http://example.com/myapp.

 Alias /myapp/ "/opt/bitnami/apps/myapp/htdocs/"
Alias /myapp "/opt/bitnami/apps/myapp/htdocs"

Include "/opt/bitnami/apps/myapp/conf/httpd-app.conf"

You can reconstruct the file from your existing configuration. The httpd-app.conf, if you have lost it also, contains the location and access of the website:

  <Directory "/opt/bitnami/apps/myapp/htdocs">
Options +MultiViews
AllowOverride None
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>

Include /opt/bitnami/apps/myapp/conf/htaccess.conf

and for a public website, I'd think htaccess would be likely empty, so you can even comment that line out.

If you have other sites on that machine, you can check their config to have an idea of how to rebuild the missing one. I've done this many times.

As a last resort, recreate an empty site from a Bitnami image of the same version, using the same parameters. You needn't install it for real. Just grab the Apache configuration files, then use them as a template for your installation.

Otherwise, but this is gross butchery, you can try recovering the configuration from the running Apache instance using this answer on ServerFault. You will then have to grep the resulting file to locate the missing parts, and store them in the appropriate files. If you go down this road, be aware that it is a mess.



Related Topics



Leave a reply



Submit