You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Thomas Cameron <th...@camerontech.com> on 2019/07/31 18:51:58 UTC

[users@httpd] No matter what I do, the httpd.pid file is created in the wrong location at runtime!

OK, I'm just trying to learn about building Apache httpd. I am doing
what I thought was a basic build and packaging it as an rpm.

My process is:

./configure --prefix=/opt/apache --exec-prefix=/opt/apache
--localstatedir=/opt/apache/var --runstatedir=/opt/apache/var/run

make

make install

I have a systemd unit file that says:

[Unit]
Description=Apache Web Server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/opt/apache/var/run/httpd.pid
ExecStart=/opt/apache/bin/apachectl start
ExecStop=/opt/apache/bin/apachectl graceful-stop
ExecReload=/opt/apache/bin/apachectl graceful
PrivateTmp=true
LimitNOFILE=infinity

[Install]
WantedBy=multi-user.target

But every time I try to start httpd using the systemctl command, it
hangs for about 2 minutes then dies.

When I run /opt/apache/bin/httpd -S I get

VirtualHost configuration:
ServerRoot: "/opt/apache"
Main DocumentRoot: "/opt/apache/htdocs"
Main ErrorLog: "/opt/apache/var/logs/error_log"
Mutex default: dir="/opt/apache/var/logs/" mechanism=default
PidFile: "/opt/apache/var/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="daemon" id=2 not_used
Group: name="daemon" id=2 not_used

What am I doing wrong? I want the pid file to go in /opt/apache/var/run
not /opt/apache/var/logs. I am sure there's a configure argument I'm
doing wrong, but I can't find what it is.

Thanks!
Thomas

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


Re: [users@httpd] No matter what I do, the httpd.pid file is created in the wrong location at runtime!

Posted by Eric Covener <co...@gmail.com>.
On Wed, Jul 31, 2019 at 4:05 PM Thomas Cameron
<th...@camerontech.com> wrote:
>
> On 7/31/19 2:46 PM, Eric Covener wrote:
> > There is a "PidFile" directive you can use in httpd.conf.  I don't
> > think there's an alternate way to get an alternate prefix or filename.
>
> Thank you! At least on my installation, it's in
> /opt/apache/conf/extra/httpd-mpm.conf. Changing PidFile there did not
> fix things.

That looks like a file that may or may not be pulled in by an
"Include" directive.
If typing gibberish into that file doesn't cause an immediate error
for apachectl -t then it's not being Include'ed.
I think it's likely you have PidFile in other config files.

> I'm still getting this:
>
> [root@ip-172-31-21-3 ~]# /opt/apache/bin/httpd -S
> PidFile: "/opt/apache/var/logs/httpd.pid"

> The line "PidFile: "/opt/apache/var/logs/httpd.pid"" is coming from the
> httpd binary. I ran strace against it and I don't see it opening any
> config files.

That line should consider the PidFile directive. But there's no way
it's ever going to know anything about things specified in systemd.

> I am almost certain it's a configure time argument that I'm getting wrong.

I don't think so.

>
> I thought that the --runstatedir in my configure step would do what I want:
>
> ./configure --prefix=/opt/apache --exec-prefix=/opt/apache
> --localstatedir=/opt/apache/var --runstatedir=/opt/apache/var/run
>
> Shouldn't that put the pid file in /opt/apache/var/run?

I don't think so. The hard-coded default is the server root + logs + httpd.pid.
In your case I think it's already overridden in a config file.

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


Re: [users@httpd] No matter what I do, the httpd.pid file is created in the wrong location at runtime!

Posted by Thomas Cameron <th...@camerontech.com>.
On 7/31/19 2:46 PM, Eric Covener wrote:
> There is a "PidFile" directive you can use in httpd.conf.  I don't
> think there's an alternate way to get an alternate prefix or filename.

Thank you! At least on my installation, it's in
/opt/apache/conf/extra/httpd-mpm.conf. Changing PidFile there did not
fix things.

I'm still getting this:

[root@ip-172-31-21-3 ~]# /opt/apache/bin/httpd -S
VirtualHost configuration:
ServerRoot: "/opt/apache"
Main DocumentRoot: "/opt/apache/htdocs"
Main ErrorLog: "/opt/apache/var/logs/error_log"
Mutex default: dir="/opt/apache/var/logs/" mechanism=default
PidFile: "/opt/apache/var/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="daemon" id=2
Group: name="daemon" id=2

The line "PidFile: "/opt/apache/var/logs/httpd.pid"" is coming from the
httpd binary. I ran strace against it and I don't see it opening any
config files.

I am almost certain it's a configure time argument that I'm getting wrong.

I thought that the --runstatedir in my configure step would do what I want:

./configure --prefix=/opt/apache --exec-prefix=/opt/apache
--localstatedir=/opt/apache/var --runstatedir=/opt/apache/var/run

Shouldn't that put the pid file in /opt/apache/var/run?

Or am I not understanding something?

Thomas

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


Re: [users@httpd] No matter what I do, the httpd.pid file is created in the wrong location at runtime!

Posted by Eric Covener <co...@gmail.com>.
> What am I doing wrong? I want the pid file to go in /opt/apache/var/run
> not /opt/apache/var/logs. I am sure there's a configure argument I'm
> doing wrong, but I can't find what it is.

There is a "PidFile" directive you can use in httpd.conf.  I don't
think there's an alternate way to get an alternate prefix or filename.

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