How do you point httpd (apache 2.4) service to another directory for startup and conf files?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I would add the -f option to the OPTIONS variable in /etc/sysconfig/httpd. Of course, before you start the service with -f /app/apache/configfile, /app/apache/configfile must exist.
Simply copying /etc/httpd to /app/apache is not enough. You need to check if there are references to /etc/httpd in the current configuration and adjust them.
No need to remove /etc/httpd. I would keep it for an easy fallback option, just in case.
I would add the -f option to the OPTIONS variable in /etc/sysconfig/httpd. Of course, before you start the service with -f /app/apache/configfile, /app/apache/configfile must exist.
Simply copying /etc/httpd to /app/apache is not enough. You need to check if there are references to /etc/httpd in the current configuration and adjust them.
No need to remove /etc/httpd. I would keep it for an easy fallback option, just in case.
Do I make the changes to /etc/systemd/system/httpd.service? What exactly do I put in the httpd.service file? What does the $OPTIONS -f entry look like?
In the new /app/apache/conf/ directory I have an Include at the bottom of the httpd.conf file:
######
Include conf/dev-test.conf
Inside dev-test.conf I have all the requisite pointers to /app/apache. I also assume in the httpd.conf file there I update ServerRoot "/app/apache"?
Do I make the changes to /etc/systemd/system/httpd.service?
I said:
Quote:
I would add the -f option to the OPTIONS variable in /etc/sysconfig/httpd
Quote:
What exactly do I put in the httpd.service file? What does the $OPTIONS -f entry look like?
You add "-f /app/apache/whateverthenameofyourconfigurationfileis" to the OPTIONS string. Unfortunately I don't have an example in front of me. A line like this probably works:
Code:
OPTIONS=${OPTIONS}" -f /app/apache/blabla"
Quote:
I also assume in the httpd.conf file there I update ServerRoot "/app/apache"?
I think so, especially if the original value of ServerRoot is /etc/httpd.
# systemctl start httpd
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2019-08-14 15:39:10 EDT; 23s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 12246 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 12239 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 12239 (code=exited, status=1/FAILURE)
Aug 14 15:39:10 dev-test.machine httpd[12239]: -M : a synonym for -t -D DUMP_MODULES
Aug 14 15:39:10 dev-test.machine httpd[12239]: -t : run syntax check for config files
Aug 14 15:39:10 dev-test.machine httpd[12239]: -T : start without DocumentRoot(s) check
Aug 14 15:39:10 dev-test.machine httpd[12239]: -X : debug mode (only one worker, do not detach)
Aug 14 15:39:10 dev-test.machine systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Aug 14 15:39:10 dev-test.machine kill[12246]: kill: cannot find process ""
Aug 14 15:39:10 dev-test.machine systemd[1]: httpd.service: control process exited, code=exited status=1
Aug 14 15:39:10 dev-test.machine systemd[1]: Failed to start The Apache HTTP Server.
Aug 14 15:39:10 dev-test.machine systemd[1]: Unit httpd.service entered failed state.
Aug 14 15:39:10 dev-test.machine systemd[1]: httpd.service failed.
You could check the journal, as suggested. I would run journalctl -u httpd, then in the program enter minus followed by upper case S (i.e., -S) so that full lines are displayed.
However the error message indicates incorrect command line options. And indeed, something is wrong with OPTIONS:
You could check the journal, as suggested. I would run journalctl -u httpd, then in the program enter minus followed by upper case S (i.e., -S) so that full lines are displayed.
However the error message indicates incorrect command line options. And indeed, something is wrong with OPTIONS:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.