Bug 1180562 - httpd.conf LogLevel problem
Summary: httpd.conf LogLevel problem
Keywords:
Status: CLOSED EOL
Alias: None
Product: JBoss Web Server 3
Classification: Retired
Component: httpd
Version: 3.0.0
Hardware: All
OS: Linux
unspecified
high
Target Milestone: DR01
: 3.0.0
Assignee: Weinan Li
QA Contact: Libor Fuka
URL:
Whiteboard:
Depends On: 1182225
Blocks: 1178630
TreeView+ depends on / blocked
 
Reported: 2015-01-09 13:02 UTC by Libor Fuka
Modified: 2020-03-27 18:37 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-27 18:37:40 UTC
Embargoed:


Attachments (Terms of Use)

Description Libor Fuka 2015-01-09 13:02:43 UTC
Description of problem:
You can set LogLevel for modules in httpd24.
The problem is:
1. We have Include conf.d/*.conf at line 56 of httpd.conf
2. and then we set globally LogLevel warn at line 189 of httpd.conf

If i set for example LogLevel debug rewrite:trace8 in conf.d/mod_rewrite.conf this setting is replaced by LogLevel warn in the httpd.conf

Version-Release number of selected component (if applicable):
JWS 3.0 DR0.2

Comment 1 Weinan Li 2015-01-11 04:17:07 UTC
To solve this problem, we should move the 'Include conf.d/*.conf' directive to the bottom of httpd.conf so customized configurations will not be overriden by httpd.conf main configurations.

However, '00-base.conf' should still be loaded firstly as it's part of the main configuration. So the fix is:

[weli@dhcp-66-78-87 jws-compose]$ git diff
diff --git a/postinstall b/postinstall
index d5da046..858d975 100644
--- a/postinstall
+++ b/postinstall
@@ -65,3 +65,9 @@ echo "PidFile ${currentDir}/run/httpd.pid" >> conf.d/00-mpm.conf
 dav_lockdb_dir='/var/lib/dav24'
 mkdir -p ${dav_lockdb_dir} 2> /dev/null
 chown apache ${dav_lockdb_dir} 2> /dev/null
+
+# bz1180562
+mv conf.d/00-base.conf conf/
+sed -i -e 's:Include conf.d/\*\.conf:Include conf/00-base.conf:' conf/httpd.conf
+echo 'Include conf.d/*.conf' >> conf/httpd.conf
+


I have roughly tested this change in my local environment and didn't find any obvious problems. If there are more problems caused by this change, please send me bug report :-)

Comment 2 Libor Fuka 2015-01-14 10:54:50 UTC
Why do we fix this problem in .postinstall and not directly in httpd.conf ?

Comment 5 Weinan Li 2015-01-22 13:05:22 UTC
(In reply to Libor Fuka from comment #2)
> Why do we fix this problem in .postinstall and not directly in httpd.conf ?

I'll check the rpm config files. Because in rpm the config file are in three directories: 'conf' 'conf.d' and 'conf.modules.d', and the config files are from multiple packages, I need to think it over to see how we make sure the behavior is same with the zip build.

I'll work on it.

Comment 6 Weinan Li 2015-01-23 04:05:06 UTC
Here is the configuration in httpd rpm package:

[weli@dhcp-66-78-87 conf]$ grep -n 'conf' httpd.conf
2:# This is the main Apache HTTP server configuration file.  It contains the
3:# configuration directives that give the server its instructions.
7:# for a discussion of each configuration directive.
23:# configuration, error, and log files are kept.
56:Include conf.modules.d/*.conf
69:# 'Main' server configuration
191:<IfModule log_config_module>
253:# CGI directory exists, if you have that configured.
269:    # AddType allows you to add to or override the MIME configuration
324:    MIMEMagicFile conf/magic
350:# Supplemental configuration
352:# Load config files in the "/etc/httpd/conf.d" directory, if any.
353:IncludeOptional conf.d/*.conf


At line 56 it loads everything in conf.modules.d/*.conf, then at last line it loads conf.d/*.conf.

When user set LogLevel debug rewrite:trace8 in conf.d/mod_rewrite.conf, it will be loaded at last of httpd.conf and won't be overwritten by the config in httpd.conf. The behavior is same with the zip build.

Please let me know if this is not sufficient.

Comment 7 Libor Fuka 2015-02-03 12:00:22 UTC
Is there any reason why we still have these lines in .postinstall ?

grep -F 'Include conf.d/*.conf' conf/httpd.conf 1> /dev/null
if [ $? -ne 0 ]; then
    echo 'Include conf.d/*.conf' >> conf/httpd.conf
fi

Its static we should have it directly in httpd.conf

Comment 8 Weinan Li 2015-02-04 17:01:46 UTC
Hi Libor,

Yes you are right :-) 

Fix:

[weli@dhcp-66-78-87 jws-compose]$ git diff
diff --git a/jws-compose.spec b/jws-compose.spec
index 55a25b4..e9669b1 100644
--- a/jws-compose.spec
+++ b/jws-compose.spec
@@ -390,6 +390,7 @@ cp %{_libdir}/%{httpd}/modules/mod_ssl.so httpd/modules/
 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/' httpd/conf/httpd.conf
+echo 'Include conf.d/*.conf' >> httpd/conf/httpd.conf

 # bz1175307 merge ssl conf
 echo -e "0r httpd/conf.d/00-ssl.conf\nw" | ed httpd/conf.d/ssl.conf
diff --git a/postinstall b/postinstall
index 161f8ad..1f751d0 100644
--- a/postinstall
+++ b/postinstall
@@ -75,9 +75,4 @@ if [ -f conf.d/00-base.conf ]; then
     sed -i -e 's:Include conf.d/\*\.conf:Include conf/00-base.conf:' conf/httpd.conf
 fi

-grep -F 'Include conf.d/*.conf' conf/httpd.conf 1> /dev/null
-if [ $? -ne 0 ]; then
-    echo 'Include conf.d/*.conf' >> conf/httpd.conf
-fi
-

Comment 9 Weinan Li 2015-02-04 17:19:11 UTC
Oh no, we can't fix it like this because in postinstall:

+++ b/postinstall
@@ -75,9 +75,4 @@ if [ -f conf.d/00-base.conf ]; then
     sed -i -e 's:Include conf.d/\*\.conf:Include conf/00-base.conf:' conf/httpd.conf
 fi

So we must put the 'echo 'Include conf.d/*.conf' >> conf/httpd.conf' at last of postinstall.

Change reverted.

Comment 10 Weinan Li 2015-02-04 17:21:11 UTC
change reverted:

[weli@dhcp-66-78-87 jws-compose]$ git diff
diff --git a/jws-compose.spec b/jws-compose.spec
index e9669b1..55a25b4 100644
--- a/jws-compose.spec
+++ b/jws-compose.spec
@@ -390,7 +390,6 @@ cp %{_libdir}/%{httpd}/modules/mod_ssl.so httpd/modules/
 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/' httpd/conf/httpd.conf
-echo 'Include conf.d/*.conf' >> httpd/conf/httpd.conf

 # bz1175307 merge ssl conf
 echo -e "0r httpd/conf.d/00-ssl.conf\nw" | ed httpd/conf.d/ssl.conf
diff --git a/postinstall b/postinstall
index 1f751d0..161f8ad 100644
--- a/postinstall
+++ b/postinstall
@@ -75,4 +75,9 @@ if [ -f conf.d/00-base.conf ]; then
     sed -i -e 's:Include conf.d/\*\.conf:Include conf/00-base.conf:' conf/httpd.conf
 fi

+grep -F 'Include conf.d/*.conf' conf/httpd.conf 1> /dev/null
+if [ $? -ne 0 ]; then
+    echo 'Include conf.d/*.conf' >> conf/httpd.conf
+fi
+

Comment 11 Weinan Li 2015-02-04 17:24:50 UTC
Correct fix:

[weli@dhcp-66-78-87 jws-compose]$ git diff
diff --git a/postinstall b/postinstall
index 161f8ad..d59ec51 100644
--- a/postinstall
+++ b/postinstall
@@ -73,11 +73,8 @@ if [ -f conf.d/00-base.conf ]; then
     mv conf.d/00-base.conf conf/
     echo "DefaultRuntimeDir ${currentDir}/run" >> conf/00-base.conf
     sed -i -e 's:Include conf.d/\*\.conf:Include conf/00-base.conf:' conf/httpd.conf
-fi
-
-grep -F 'Include conf.d/*.conf' conf/httpd.conf 1> /dev/null
-if [ $? -ne 0 ]; then
     echo 'Include conf.d/*.conf' >> conf/httpd.conf
 fi


+
[weli@dhcp-66-78-87 jws-compose]$

Comment 12 Libor Fuka 2015-03-09 11:04:07 UTC
Verified with ER1


Note You need to log in before you can comment on or make changes to this bug.