Where is documentation of switch options for apache2ctl command? - apache

I can run apache2ctl -S on my debian box and it outputs information about the virtual hosts on the server and other information.
However, when I issue man apache2ctl on my debian box, I don't see any documentation for the the -S switch or any other switches for that matter. Where can I find this documentation?

The man page states that apachectl acts either as passthrough frontend script for httpd binary itself or as service control script for starting, stopping, reloading.
In turn You can / should consult the man page for httpd to find the information about such switches.

Related

M1 BigSur httpd error LaunchAgents/homebrew.mxcl.httpd.plist

I am a bit confused that Apache httpd.conf not in the /usr/local/etc/ anymore, because there is no visible etc/ folder in the local. It's being empty. So did a bit search and found the a httpd.conf in the /etc/apache2/httpd.conf not very sure it is the right file, because it looks bit different. Anyway the below issue started after loading brew install httpd
httpd error LaunchAgents/homebrew.mxcl.httpd.plist
when I use the command brew services start httpd it gives the message of ==> Successfully started httpd (label: homebrew.mxcl.httpd) but when I check the services list I see the httpd error. And when I try to reach localhost I see It works message but when I refresh the page no more It works message and I only see the localhost refused to connect.
what is the correct way to install and run the apache?

ERR_EMPTY_RESPONSE when active mpm_event

I try to activate mpm_eventon my Apache (OS Debian 9 ) and disable mpm_prefork for active http/2 on my site.
But When I do that, my site goes down and shows ERR_EMPTY_RESPONSE on the browser.
The following commands I used to do that:
sudo apt-get install php7.4-fpm
sudo a2enmod proxy_fcgi
sudo a2dismod php7.4
sudo a2enconf php7.4-fpm
sudo a2dismod mpm_prefork
sudo a2enmod mpm_event
sudo service apache2 restart
In the apache log I see just this error:
AH00052: child pid 27520 exit signal Aborted (6)
Is there anyone who knows what should I do to fix that?
I found out that the problem is because of Mod_Ruid2 conflicts with PHP_fpm.
When I disabled Mod_Ruid2 the site was back up and running without any problems.
a2dismod ruid2
The purpose of mod_ruid2 is to allow run of scripts with the users
permission when Apache is using mod_php. In that mode Apache is ran
with root and child processes are being setuid-ed to the proper user
so they can't touch other user files.
The php-fpm is completely different approach. With php-fpm the apache
does not compile php scripts - everything is done by external binary
(called php-fpm). Therefore there is absolutely no need for mod_ruid2
when you are using php-fpm.
https://forum.directadmin.com/threads/php-fpm-and-mod_ruid2-with-php7-1.56552/
https://forum.vestacp.com/viewtopic.php?t=16041

Apache configuration: how to get quick feedback?

When writing configuration files for Apache web server I would like to have a quick feedback loop.
I, for example have a script that doesn't seem to work. It is either not picked up, or the variables I use are not set, or maybe overriding is not allowed. How to debug this?
I expected to at least print some debug log statements like REQUEST_URI: %{REQUEST_URI}. Can't find such a thing.
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.
Here is a link to the documentation.
Different platform might use different binary names such as apache, apache2 or apache2ctl. To test the configuration - just run:
apachectl configtest
# or, depending on your OS
httpd -t
EDIT
If you are trying to debug your virtual host configuration, you may find the Apache -S command line switch useful. That is, type the following command:
httpd -S
This command will dump out a description of how Apache parsed the configuration file

apachectl -t -D DUMP_VHOSTS not showing aliases

I'm running various version of apache 2.2.15 and 2.4(.6 and .7) on a number of servers (some ubuntu some centos) with similar configurations (2.4 and 2.2 differences are handled), but with different sites on each.
I have a script which uses apachectl -t -D DUMP_VHOSTS to get a list of the virtual hosts configured on a particular server, and it works fine to get me a list of virtual hosts, and my script happily handles the differences from output from 2.2 and 2.4
However, I need to include aliases in the output from my script. Searching the internet tells me that the above should list aliases under each vhost. It doesn't, on any of my servers. https://bz.apache.org/bugzilla/show_bug.cgi?id=51680 even says it was included in the main source at 2.4.1. https://ma.ttias.be/apachectl-linux-get-entire-apache-vhost-configuration-one-output/ shows what looks like 2.2 output with aliases
Can anyone tell me how to make this work?
Thanks
EDIT:-
ezra-s asked for an example of what I'm seeing, this is typical, and comes from Ubuntu 14 running 2.4.7
/var/www/html$ apachectl -t -D DUMP_VHOSTS
VirtualHost configuration:
*:80 <host>.simon.uk (/etc/apache2/sites-enabled/simon.uk.conf:1)
*:8080 <host>.simon.uk (/etc/apache2/sites-enabled/simon.uk.conf:42)
*:443 ubuntu.<domain removed> (/etc/apache2/sites-enabled/ssl_proxy.conf:12)
As mentioned in comments I tracked the output down to server/vhost.c:dump_a_vhost() in the apache source. In there is code that ultimately shows the above summary, over the detailed output with aliases, when there are no NameVirtualHosts defined. Guess what, they were depreciated in 2.4 so can't be defined anymore.
I've logged this as a bug at https://bz.apache.org/bugzilla/show_bug.cgi?id=61019

How to see which clients are requesting in my apache?

I am using apache2 in my Ubuntu 13.10 as a server. Now How can I see the IP of the clients ?
Assuming the default configuration of Ubuntu 13.10:
tail /var/log/apache2/access.log
You can also do a "live view" that updates whenever someone accesses your page:
tail -f /var/log/apache2/access.log