Bug 1171807

Summary: httpd config files are in a wrong directory
Product: [Retired] JBoss Web Server 3 Reporter: Michal Haško <mhasko>
Component: unspecifiedAssignee: Weinan Li <weli>
Status: CLOSED EOL QA Contact: Pavel Slavicek <pslavice>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.0.0CC: jclere, lfuka, mbabacek, mturk, pslavice
Target Milestone: DR01   
Target Release: 3.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-27 18:37:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1172303, 1172304, 1175307, 1178630, 1185767    

Description Michal Haško 2014-12-08 16:19:23 UTC
Description of problem:
# ls jws-3.0/httpd/*.conf
jws-3.0/httpd/httpd-autoindex.conf
jws-3.0/httpd/httpd-dav.conf
jws-3.0/httpd/httpd-default.conf
jws-3.0/httpd/httpd-info.conf
jws-3.0/httpd/httpd-languages.conf
jws-3.0/httpd/httpd-manual.conf
jws-3.0/httpd/httpd-mpm.conf
jws-3.0/httpd/httpd-multilang-errordoc.conf
jws-3.0/httpd/httpd-ssl.conf
jws-3.0/httpd/httpd-userdir.conf
jws-3.0/httpd/httpd-vhosts.conf
jws-3.0/httpd/proxy-html.conf

These files should probably be located in the jws-3.0/httpd/conf.d directory

Version-Release number of selected component (if applicable):
jws-httpd-3.0.0-DR0-RHEL*.zip

Comment 1 Michal Haško 2014-12-08 16:40:36 UTC
Maybe the files should be in httpd/conf.modules.d:

# cd jws-3.0/httpd/sbin
# sudo ./apachectl start
# cat ../logs/httpd.log 
httpd: Syntax error on line 56 of /opt/ews/workspace/jws-3.0/httpd/conf/httpd.conf: Could not open config directory /opt/ews/workspace/jws-3.0/httpd/conf.modules.d: No such file or directory

Comment 2 Weinan Li 2014-12-09 10:08:25 UTC
In jws-compose:

[weli@dhcp-66-78-87 jws-compose]$ git diff
diff --git a/jws-compose.spec b/jws-compose.spec
index 9896517..2568410 100644
--- a/jws-compose.spec
+++ b/jws-compose.spec
@@ -215,7 +215,10 @@ done

 # httpd
 unzip -q %{_javadir}/jbossas-fordev/httpd-%{httpdversion}.zip
-cp -pr %{_docdir}/%{httpd}-%{httpdversion}/* httpd/
+
+# BZ1171807 - We don't move sample conf files into httpd/
+cp -pr %{_docdir}/%{httpd}-%{httpdversion}/{ABOUT_APACHE,README,CHANGES,LICENSE,VERSIONING,NOTICE} httpd/
+
 cp %{SOURCE4} httpd/.postinstall
 chmod 755 httpd/.postinstall httpd/sbin/*
 sed -i -e '/# Source ..\/conf\/httpd.conf/,/fi/d' httpd/sbin/apachectl

In httpd24:

[weli@dhcp-66-78-87 httpd24-jws3-el7]$ git diff
diff --git a/httpd.spec b/httpd.spec
index 0e06374..846e4d1 100644
--- a/httpd.spec
+++ b/httpd.spec
@@ -466,11 +466,29 @@ ln -s ../../pixmaps/poweredby.png \

 mv $RPM_BUILD_ROOT%{_bindir}/apxs $RPM_BUILD_ROOT%{_sbindir}/apxs

+# install conf file/directory
+mkdir $RPM_BUILD_ROOT%{_sysconfdir}/httpd%{jws}/conf.modules.d
+install -m 644 $RPM_SOURCE_DIR/README.confd \
+    $RPM_BUILD_ROOT%{_sysconfdir}/httpd%{jws}/conf.d/README
+
+for f in 00-base.conf 00-mpm.conf 01-cgi.conf 00-dav.conf \
+         00-proxy.conf 00-ssl.conf 01-ldap.conf 00-proxyhtml.conf \
+         01-ldap.conf 01-session.conf; do
+  install -m 644 -p $RPM_SOURCE_DIR/$f \
+        $RPM_BUILD_ROOT%{_sysconfdir}/httpd%{jws}/conf.modules.d/$f
+done
+
+for f in welcome.conf ssl.conf manual.conf userdir.conf; do
+  install -m 644 -p $RPM_SOURCE_DIR/$f \
+        $RPM_BUILD_ROOT%{_sysconfdir}/httpd%{jws}/conf.d/$f
+done
+
 %if %{with_zips}
 pushd $RPM_BUILD_ROOT
-mkdir -p httpd/{include,lib/build,sbin,cache/mod_ssl%{jws},conf,conf.d,logs,run,var,modules,www/html,www/error}
+mkdir -p httpd/{include,lib/build,sbin,cache/mod_ssl%{jws},conf,conf.d,conf.modules.d,logs,run,var,modules,www/html,www
 cp -r $RPM_SOURCE_DIR/index.html httpd/www/error/noindex.html
 cp -r $RPM_BUILD_ROOT%{_sysconfdir}/httpd%{jws}/conf.d/* httpd/conf.d/
+cp -r $RPM_BUILD_ROOT%{_sysconfdir}/httpd%{jws}/conf.modules.d/* httpd/conf.modules.d/
 cp -r $RPM_BUILD_ROOT%{_sysconfdir}/httpd%{jws}/conf/{httpd.conf,magic} httpd/conf/
 cp -r $RPM_BUILD_ROOT%{_localstatedir}/www/httpd%{jws}/{cgi-bin,error,icons} httpd/www
 cp -r $RPM_BUILD_ROOT%{_localstatedir}/cache/* httpd/cache/
@@ -492,23 +510,6 @@ popd
 #Fix JBPAPP-3883
 sed -i -e "s|/usr/sbin/httpd|/usr/sbin/httpd%{jws}|" $RPM_BUILD_ROOT%{_sbindir}/apachectl

-# install conf file/directory
-mkdir $RPM_BUILD_ROOT%{_sysconfdir}/httpd%{jws}/conf.modules.d
-install -m 644 $RPM_SOURCE_DIR/README.confd \
-    $RPM_BUILD_ROOT%{_sysconfdir}/httpd%{jws}/conf.d/README
-
-for f in 00-base.conf 00-mpm.conf 01-cgi.conf 00-dav.conf \
-         00-proxy.conf 00-ssl.conf 01-ldap.conf 00-proxyhtml.conf \
-         01-ldap.conf 01-session.conf; do
-  install -m 644 -p $RPM_SOURCE_DIR/$f \
-        $RPM_BUILD_ROOT%{_sysconfdir}/httpd%{jws}/conf.modules.d/$f
-done
-
-for f in welcome.conf ssl.conf manual.conf userdir.conf; do
-  install -m 644 -p $RPM_SOURCE_DIR/$f \
-        $RPM_BUILD_ROOT%{_sysconfdir}/httpd%{jws}/conf.d/$f
-done
-
 # Remove everything duplicated with the base httpd package
 rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/httpd%{jws}/logs

It will be included into next builds.

Comment 3 Michal Karm Babacek 2014-12-09 12:38:48 UTC

Option 1: IncludeOptional
=========================
Maybe, you've already done that, but in case you didn't:
Weinan, could you please, apart from creating the missing conf.modules.d directory, change the include in httpd.conf from

> Include conf.modules.d/*.conf

to 

> IncludeOptional conf.modules.d/*.conf

?

If there is a reason for having "Include" instead of "IncludeOptional" there, please, enlighten us. otherwise it seems wrong to me, because the directory might be empty.


Option 2: Remove conf.modules.d
===============================
According to [1], modules packaged with httpd itself should occupy conf.d, whereas modules installed later, as separate rpm packages should be filed into conf.modules.d. In our httpd ZIP distribution, it actually doesn't make much sense to keep the conf.modules.d around, i.e. we package all the modules in a one zip, there are no "additional modules" installed later on via rpm... 

Michal Hasko, WDYT? Should we go with Option 2 and remove the directory from the zip distro?

[1] http://fedoraproject.org/wiki/PackagingDrafts/ApacheHTTPModules#New_Configuration_Directory_Layout

Comment 4 Michal Haško 2014-12-09 13:28:14 UTC
I think that the problem conf.modules.d is solving doesn't exist in JWS zip distro. If anything, it would bring more confusion for the customer.

Comment 5 Michal Karm Babacek 2014-12-09 19:56:42 UTC
Missing: PidFile run/httpd.pid - wrong path in httpd-mpm.conf 
We need .postinstall to pick up httpd-mpm.conf and set a correct path to PidFile.

I've just rephrased the title of this Bugzilla so as it reflects the actual state of the build more accurately. I was kinda tempted to put there "all config files" :-)

Thank you Weinan for looking into it and for your time.

Cheers.

K.

Comment 6 Weinan Li 2014-12-10 04:13:08 UTC
Verified locally:

[weli@dhcp-66-78-87 x86_64]$ unzip -l ./usr/share/java/jbossas-fordev/jws-httpd-3.0.0-RHEL6-x86_64.zip | grep conf
       26  12-09-2014 21:44   jws-3.0/httpd/bin/apu-jws3-1-config
       26  12-09-2014 21:44   jws-3.0/httpd/bin/apr-jws3-1-config
    86799  12-09-2014 18:06   jws-3.0/httpd/modules/mod_log_config.so
     3347  12-09-2014 18:06   jws-3.0/httpd/lib/build/config_vars.mk
     2027  12-09-2014 18:06   jws-3.0/httpd/lib/build/config.nice
        0  12-09-2014 21:44   jws-3.0/httpd/conf/
    13077  12-09-2014 18:06   jws-3.0/httpd/conf/magic
    11753  12-09-2014 21:44   jws-3.0/httpd/conf/httpd.conf
        0  12-09-2014 18:06   jws-3.0/httpd/conf.modules.d/
     3739  12-09-2014 18:06   jws-3.0/httpd/conf.modules.d/00-base.conf
      894  12-09-2014 18:06   jws-3.0/httpd/conf.modules.d/00-proxy.conf
      451  12-09-2014 18:06   jws-3.0/httpd/conf.modules.d/01-cgi.conf
      159  12-09-2014 18:06   jws-3.0/httpd/conf.modules.d/00-proxyhtml.conf
      287  12-09-2014 18:06   jws-3.0/httpd/conf.modules.d/01-session.conf
      141  12-09-2014 18:06   jws-3.0/httpd/conf.modules.d/01-ldap.conf
      139  12-09-2014 18:06   jws-3.0/httpd/conf.modules.d/00-dav.conf
       41  12-09-2014 18:06   jws-3.0/httpd/conf.modules.d/00-ssl.conf
      742  12-09-2014 18:06   jws-3.0/httpd/conf.modules.d/00-mpm.conf
    54624  12-09-2014 18:06   jws-3.0/httpd/include/http_config.h
     7924  12-09-2014 18:06   jws-3.0/httpd/include/ap_config_auto.h
     2485  12-09-2014 18:06   jws-3.0/httpd/include/mod_log_config.h
     6606  12-09-2014 18:06   jws-3.0/httpd/include/ap_config.h
     2787  12-09-2014 18:06   jws-3.0/httpd/include/ap_config_layout.h
        0  12-09-2014 21:44   jws-3.0/httpd/conf.d/
       34  12-09-2014 21:44   jws-3.0/httpd/conf.d/auth_kerb.conf
       40  11-05-2014 20:32   jws-3.0/httpd/conf.d/mod_rt.conf.sample
      366  12-09-2014 18:06   jws-3.0/httpd/conf.d/README
     9426  12-09-2014 18:06   jws-3.0/httpd/conf.d/ssl.conf
      295  12-09-2014 18:06   jws-3.0/httpd/conf.d/manual.conf
      713  12-09-2014 21:44   jws-3.0/httpd/conf.d/mod_cluster.conf
      566  12-09-2014 18:06   jws-3.0/httpd/conf.d/proxy_ajp.conf
     1252  12-09-2014 18:06   jws-3.0/httpd/conf.d/userdir.conf
      516  12-09-2014 18:06   jws-3.0/httpd/conf.d/welcome.conf

Comment 7 Weinan Li 2014-12-10 04:14:58 UTC
(In reply to Michal Babacek from comment #5)
> Missing: PidFile run/httpd.pid - wrong path in httpd-mpm.conf 
> We need .postinstall to pick up httpd-mpm.conf and set a correct path to
> PidFile.
> 
> I've just rephrased the title of this Bugzilla so as it reflects the actual
> state of the build more accurately. I was kinda tempted to put there "all
> config files" :-)
> 
> Thank you Weinan for looking into it and for your time.
> 
> Cheers.
> 
> K.

Thanks Michal! I will work on this one. (btw, could you please create a bug for this?)

Comment 8 Weinan Li 2014-12-22 13:02:55 UTC
(In reply to Michal Babacek from comment #5)
> Missing: PidFile run/httpd.pid - wrong path in httpd-mpm.conf 
> We need .postinstall to pick up httpd-mpm.conf and set a correct path to
> PidFile.
> 
> I've just rephrased the title of this Bugzilla so as it reflects the actual
> state of the build more accurately. I was kinda tempted to put there "all
> config files" :-)
> 
> Thank you Weinan for looking into it and for your time.
> 
> Cheers.
> 
> K.

httpd-mpm.conf is a wrong one and it's removed. The correct one is put into conf.modules.d instead:

jws-httpd-3.0.0-RHEL6-x86_64.zip
[weli@dhcp-66-78-87 jbossas-fordev]$ cd jws-3.0/httpd/
[weli@dhcp-66-78-87 httpd]$ cat ./conf.modules.d/00-mpm.conf
# Select the MPM module which should be used by uncommenting exactly
# one of the following LoadModule lines:

# prefork MPM: Implements a non-threaded, pre-forking web server
# See: http://httpd.apache.org/docs/2.4/mod/prefork.html
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

# worker MPM: Multi-Processing Module implementing a hybrid
# multi-threaded multi-process web server
# See: http://httpd.apache.org/docs/2.4/mod/worker.html
#
#LoadModule mpm_worker_module modules/mod_mpm_worker.so

# event MPM: A variant of the worker MPM with the goal of consuming
# threads only for connections with active processing
# See: http://httpd.apache.org/docs/2.4/mod/event.html
#
#LoadModule mpm_event_module modules/mod_mpm_event.so

Comment 9 Michal Karm Babacek 2014-12-22 13:40:33 UTC
Hi Weinan, could you please comment on Comment 4 and Comment 3 regarding conf.modules.d?

We are under the impression that it is actually an RPM specific directory structure design, i.e. designated for storing configuration files for httpd modules installed separately as RPM packages (modules not being part of the core httpd RPM installation). Shouldn't we work only with conf/ and conf.d/ directories?

Thanks for comments :-)

Comment 10 Weinan Li 2014-12-22 14:00:25 UTC
(In reply to Michal Babacek from comment #9)
> Hi Weinan, could you please comment on Comment 4 and Comment 3 regarding
> conf.modules.d?
> 
> We are under the impression that it is actually an RPM specific directory
> structure design, i.e. designated for storing configuration files for httpd
> modules installed separately as RPM packages (modules not being part of the
> core httpd RPM installation). Shouldn't we work only with conf/ and conf.d/
> directories?
> 
> Thanks for comments :-)

If others agree I'll merge it :-)

Comment 11 Weinan Li 2014-12-23 09:59:26 UTC
Fix:


[weli@dhcp-66-78-87 jws-compose]$ git diff
diff --git a/jws-compose.spec b/jws-compose.spec
index ab0e795..f30f91a 100644
--- a/jws-compose.spec
+++ b/jws-compose.spec
@@ -367,6 +367,19 @@ ln -s %{_bindir}/%{apr}-1-config httpd/bin/
 ln -s %{_bindir}/%{apu}-1-config httpd/bin/
 %endif

+# mod_ssl
+cp %{_sysconfdir}/%{httpd}/conf.d/ssl.conf httpd/conf.d/
+cp %{_sysconfdir}/%{httpd}/conf.modules.d/00-ssl.conf httpd/conf.d/
+cp %{_libdir}/%{httpd}/modules/mod_ssl.so httpd/modules/
+
+# bz1171807 merge conf dir
+mv httpd/conf.modules.d/* httpd/conf.d/
+rm -rf httpd/conf.modules.d
+sed -i -e '/IncludeOptional conf\.d\/\*\.conf/d' -e  's/Include conf\.modules\.d/Include conf\.d/' htt
+# bz1175307 merge ssl conf
+echo -e "0r httpd/conf.d/00-ssl.conf\nw" | ed httpd/conf.d/ssl.conf
+rm httpd/conf.d/00-ssl.conf
+
 %ifnarch ppc64
 #jsvc
 mkdir -p extras
diff --git a/postinstall b/postinstall
index eb78eec..5df578e 100644
--- a/postinstall
+++ b/postinstall
@@ -46,9 +46,9 @@ fi
 sed -i -e "s:/var/www:${pkgdir}/httpd/www:g" -e "s:/etc/httpd:${pkgdir}/httpd:g" www/error/noindex.htm

 #JBPAPP-9446
-sed -i -e "s:LoadModule proxy_balancer_module modules/mod_proxy_balancer.so:#LoadModule proxy_balancer
+sed -i -e "s:LoadModule proxy_balancer_module modules/mod_proxy_balancer.so:#LoadModule proxy_balancer

-echo "DefaultRuntimeDir ${currentDir}/run" >> conf.modules.d/00-base.conf
+echo "DefaultRuntimeDir ${currentDir}/run" >> conf.d/00-base.conf

 sed -i -e "s:/usr/libexec/:${currentDir}/sbin/:" -e "s:/var/www:${currentDir}/www:g" -e "s:/run/httpd/


---

Local verification:

[weli@dhcp-66-78-87 httpd]$ ls
ABOUT_APACHE  cache    conf    include  LICENSE  modules  README  sbin  VERSIONING
bin           CHANGES  conf.d  lib      logs     NOTICE   run     var   www

---

[weli@dhcp-66-78-87 httpd]$ ls conf.d
00-base.conf  00-proxy.conf      01-ldap.conf       manual.conf         proxy_ajp.conf  userdir.conf
00-dav.conf   00-proxyhtml.conf  01-session.conf    mod_cluster.conf    README          welcome.conf

---

[weli@dhcp-66-78-87 httpd]$ grep 'Include.*conf.*d' conf/httpd.conf
Include conf.d/*.conf

---

[weli@dhcp-66-78-87 httpd]$ tail -f logs/error_log
[Tue Dec 23 17:56:15.963210 2014] [core:notice] [pid 15813] SELinux policy enabled; httpd running as context unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[Tue Dec 23 17:56:15.993072 2014] [so:warn] [pid 15813] AH01574: module proxy_ajp_module is already loaded, skipping
[Tue Dec 23 17:56:16.005346 2014] [auth_digest:notice] [pid 15814] AH01757: generating secret for digest authentication ...
[Tue Dec 23 17:56:16.006868 2014] [lbmethod_heartbeat:notice] [pid 15814] AH02282: No slotmem from mod_heartmonitor
[Tue Dec 23 17:56:16.010437 2014] [:notice] [pid 15814] Advertise initialized for process 15814
[Tue Dec 23 17:56:16.013955 2014] [mpm_prefork:notice] [pid 15814] AH00163: Apache/2.4.6 (Red Hat) mod_auth_kerb/5.4 mod_cluster/1.3.1.Beta1 OpenSSL/1.0.1e-fips configured -- resuming normal operations
[Tue Dec 23 17:56:16.013992 2014] [core:notice] [pid 15814] AH00094: Command line: '/home/weli/rpmbuild/RPMS/x86_64/jws-3.0/httpd/sbin/httpd -f /home/weli/rpmbuild/RPMS/x86_64/jws-3.0/httpd/conf/httpd.conf -E /home/weli/rpmbuild/RPMS/x86_64/jws-3.0/httpd/logs/httpd.log'
00-mpm.conf   01-cgi.conf        10-auth_kerb.conf  mod_rt.conf.sample  ssl.conf

Comment 12 Libor Fuka 2015-01-20 13:52:53 UTC
Verified with DR1 build.