You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Dirk Devos <di...@usa.net> on 2015/06/03 15:36:59 UTC

[users@httpd] Documentation for /etc/sysconfig/httpd file

Hi,

I am running Redhat 7.1 and apache 2.4 but I am not able to find any
documentation on the "/etc/sysconfig/httpd" file.

I am new to apache and I am trying to save the value of "uname -n" to a
variable and from what I was reading the place to set the value would be in
the "/etc/sysconfig/httpd" file. 

I was able to assign a constant value to a variable but I would like to get
the name of the server that is running the httpd daemon so that I can use
regex to determine if I am running in development or production.


This works.

HTTPD_ENV_NAME="devl"


I have tried the following with no success.

HTTPD_HOSTNAME=`hostname`
HTTPD_HOSTNAME=${hostname}
HTTPD_HOSTNAME=$(hostname)

Any help on what I am doing wrong would be appreciated.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Documentation for /etc/sysconfig/httpd file

Posted by "Jens-U. Mozdzen" <jm...@nde.ag>.
Hi Dirk,

Zitat von Dirk Devos <di...@usa.net>:
> I am confused. Based on the documentation on apache's website we  
> need to use "apachectl" but in that module it says to use  
> "apachectl". So what is the right place.

hm, looks identical to me ;) And on a random machine I picked to look  
things up, it's "apache2ctl" :D

> I realize that the variables are different and that was done on  
> purpose. I wanted to compare the two ways of assigning a value.

and what happens if you dynamically assign a value to the variable  
that's currently working statically and vice versa?

To me it looks like you have to find out if either

a - it's a problem assigning the value (including finding the right  
place to do so), which is more of a "shell programming" question, or

b - it's a problem of accessing the content of a shell variable from  
where you're trying to do so (which might be an httpd question)

Regards,
Jens


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Documentation for /etc/sysconfig/httpd file

Posted by Dirk Devos <di...@usa.net>.
I am confused. Based on the documentation on apache's website we need to use "apachectl" but in that module it says to use "apachectl". So what is the right place.

I realize that the variables are different and that was done on purpose. I wanted to compare the two ways of assigning a value. 

******   From http://httpd.apache.org/docs/2.4/programs/apachectl.html
apachectl is a front end to the Apache HyperText Transfer Protocol (HTTP) server. It is designed to help the administrator control the functioning of the Apache httpd daemon.
The apachectl script can operate in two modes. First, it can act as a simple front-end to the httpd command that simply sets any necessary environment variables and then invokes httpd, passing through any command line arguments. Second, apachectl can act as a SysV init script, taking simple one-word arguments like start, restart, and stop, and translating them into appropriate signals to httpd.
If your Apache installation uses non-standard paths, you will need to edit the apachectl script to set the appropriate paths to the httpd binary. You can also specify any necessary httpd command line arguments. See the comments in the script for details.
The apachectl script returns a 0 exit value on success, and >0 if an error occurs. For more details, view the comments in the script.


******   So I found the "apachectl" file in "/usr/sbin/" and in the file I found the following.
if [ "x$2" != "x" ] ; then
    echo Passing arguments to httpd using apachectl is no longer supported.
    echo You can only start/stop/restart httpd using this script.
    echo If you want to pass extra arguments to httpd, edit the
    echo /etc/sysconfig/httpd config file.
fi

-----Original Message-----
From: Jens-U. Mozdzen [mailto:jmozdzen@nde.ag] 
Sent: Wednesday, June 03, 2015 2:45 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Documentation for /etc/sysconfig/httpd file

Hi Andy,

Zitat von Andy Wang <aw...@ptc.com>:
> On 06/03/2015 10:31 AM, Jens-U. Mozdzen wrote:
>> Hi Dirk,
>>
>> Zitat von Dirk Devos <di...@usa.net>:
>>> Hi,
>>>
>>> I am running Redhat 7.1 and apache 2.4 but I am not able to find any 
>>> documentation on the "/etc/sysconfig/httpd" file.
>>> [...]
>>> This works.
>>>
>>> HTTPD_ENV_NAME="devl"
>>>
>>>
>>> I have tried the following with no success.
>>>
>>> HTTPD_HOSTNAME=`hostname`
>>> HTTPD_HOSTNAME=${hostname}
>>> HTTPD_HOSTNAME=$(hostname)
>>
>> the first an the last line should work (while I prefer the $() 
>> version)
>> - what catches the eye is the change in variable names 
>> (HTTPD_ENV_NAME vs. HTTPD_HOSTNAME)...
>>
>> Regards,
>> Jens
>>
>
> Couple of starter points
> 1) the apache httpd project is not responsible for the distribution 
> specific builds.  The /etc/sysconfig/httpd thing is a red hat-ism.

just for the records, you'll see that with SUSE Linux Enterprise
(SLES) as well, at least up to (still widely used) SLES11.

> 2) you should contact red hat for support on that
>
> In general /etc/sysconfig/httpd (which at some point will be deprected 
> -it already is with fedora as systemd generally doesn't use 
> /etc/sysconfig files) are simply ./sourced into the init script

well, had you redirected the OP to some shell scripting list, I'd have agreed, but...

> [...] So you'll want to look more closely at the init script and the 
> httpd configuration files to even know if what you're trying to do in 
> /etc/sysconfig/httpd is doable.

...obviously he already found a working way of setting the value statically, but didn't manage to do so dynamically. Hence I thought it polite to point out that mismatch in variable names between these two variants.

Regards,
Jens


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Documentation for /etc/sysconfig/httpd file

Posted by "Jens-U. Mozdzen" <jm...@nde.ag>.
Hi Andy,

Zitat von Andy Wang <aw...@ptc.com>:
> On 06/03/2015 10:31 AM, Jens-U. Mozdzen wrote:
>> Hi Dirk,
>>
>> Zitat von Dirk Devos <di...@usa.net>:
>>> Hi,
>>>
>>> I am running Redhat 7.1 and apache 2.4 but I am not able to find any
>>> documentation on the "/etc/sysconfig/httpd" file.
>>> [...]
>>> This works.
>>>
>>> HTTPD_ENV_NAME="devl"
>>>
>>>
>>> I have tried the following with no success.
>>>
>>> HTTPD_HOSTNAME=`hostname`
>>> HTTPD_HOSTNAME=${hostname}
>>> HTTPD_HOSTNAME=$(hostname)
>>
>> the first an the last line should work (while I prefer the $() version)
>> - what catches the eye is the change in variable names (HTTPD_ENV_NAME
>> vs. HTTPD_HOSTNAME)...
>>
>> Regards,
>> Jens
>>
>
> Couple of starter points
> 1) the apache httpd project is not responsible for the distribution  
> specific builds.  The /etc/sysconfig/httpd thing is a red hat-ism.

just for the records, you'll see that with SUSE Linux Enterprise  
(SLES) as well, at least up to (still widely used) SLES11.

> 2) you should contact red hat for support on that
>
> In general /etc/sysconfig/httpd (which at some point will be  
> deprected -it already is with fedora as systemd generally doesn't  
> use /etc/sysconfig files) are simply ./sourced into the init script

well, had you redirected the OP to some shell scripting list, I'd have  
agreed, but...

> [...] So you'll want to look more closely at the init script and the  
> httpd configuration files to even know if what you're trying to do  
> in /etc/sysconfig/httpd is doable.

...obviously he already found a working way of setting the value  
statically, but didn't manage to do so dynamically. Hence I thought it  
polite to point out that mismatch in variable names between these two  
variants.

Regards,
Jens


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Documentation for /etc/sysconfig/httpd file

Posted by Andy Wang <aw...@ptc.com>.

On 06/03/2015 10:31 AM, Jens-U. Mozdzen wrote:
> Hi Dirk,
>
> Zitat von Dirk Devos <di...@usa.net>:
>> Hi,
>>
>> I am running Redhat 7.1 and apache 2.4 but I am not able to find any
>> documentation on the "/etc/sysconfig/httpd" file.
>> [...]
>> This works.
>>
>> HTTPD_ENV_NAME="devl"
>>
>>
>> I have tried the following with no success.
>>
>> HTTPD_HOSTNAME=`hostname`
>> HTTPD_HOSTNAME=${hostname}
>> HTTPD_HOSTNAME=$(hostname)
>
> the first an the last line should work (while I prefer the $() version)
> - what catches the eye is the change in variable names (HTTPD_ENV_NAME
> vs. HTTPD_HOSTNAME)...
>
> Regards,
> Jens
>

Couple of starter points
1) the apache httpd project is not responsible for the distribution 
specific builds.  The /etc/sysconfig/httpd thing is a red hat-ism.
2) you should contact red hat for support on that

In general /etc/sysconfig/httpd (which at some point will be deprected 
-it already is with fedora as systemd generally doesn't use 
/etc/sysconfig files) are simply ./sourced into the init script 
environment.  So if the particular VARNAME value is actually USED by the 
distro init scripts and passed into it's httpd configuration, it will be 
used.  If it's not, then it doesn't actually have any impact at all.  So 
you'll want to look more closely at the init script and the httpd 
configuration files to even know if what you're trying to do in 
/etc/sysconfig/httpd is doable.

Andy


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Documentation for /etc/sysconfig/httpd file

Posted by "Jens-U. Mozdzen" <jm...@nde.ag>.
Hi Dirk,

Zitat von Dirk Devos <di...@usa.net>:
> Hi,
>
> I am running Redhat 7.1 and apache 2.4 but I am not able to find any
> documentation on the "/etc/sysconfig/httpd" file.
> [...]
> This works.
>
> HTTPD_ENV_NAME="devl"
>
>
> I have tried the following with no success.
>
> HTTPD_HOSTNAME=`hostname`
> HTTPD_HOSTNAME=${hostname}
> HTTPD_HOSTNAME=$(hostname)

the first an the last line should work (while I prefer the $()  
version) - what catches the eye is the change in variable names  
(HTTPD_ENV_NAME vs. HTTPD_HOSTNAME)...

Regards,
Jens


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org