How to see which clients are requesting in my apache? - 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

Related

How to proxy web requests to Lucee/Tomcat under Apache?

I'm having trouble setting Lucce to run on Apache in a CentOS 9 machine.
The steps I've followed are bellow:
Installed .run file from https://downloads.lucee.org
Left the default for apachectl, httpd conf and http modules (I've already checked and it seems they're correct, I can provide the values if you need)
Set Tomcat to run on port 8888, the default value (tomcat is in fact running because i can access it externally)
Accepted to install Apache connector
Accepted to install mod_cfml
Then, when Lucee is being installed, I get a post-install step error, mentioning that the installation may not complete correctly:
Error running /opt/lucee/sys/install_mod_proxy.sh -m install -t 8888 -f
/etc/httpd/conf/httpd.conf -c /usr/sbin/apachectl: apachectl: The "-M" option is
not supported.
apachectl: The "-M" option is not supported.
But the installation process ends and everything seems to be fine.
Tomcat is running (I can access through domain.com:8888)
Proxy is added to httpd.conf file with the following rules
<IfModule mod_proxy.c>
ProxyPreserveHost On
ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$ http://127.0.0.1:8888/$1$2
ProxyPassMatch ^/(.+\.cfml)(/.*)?$ http://127.0.0.1:8888/$1$2
# optional mappings
#ProxyPassMatch ^/flex2gateway/(.*)$ http://127.0.0.1:8888/flex2gateway/$1
#ProxyPassMatch ^/messagebroker/(.*)$ http://127.0.0.1:8888/messagebroker/$1
#ProxyPassMatch ^/flashservices/gateway(.*)$ http://127.0.0.1:8888/flashservices/gateway$1
#ProxyPassMatch ^/openamf/gateway/(.*)$ http://127.0.0.1:8888/openamf/gateway/$1
#ProxyPassMatch ^/rest/(.*)$ http://127.0.0.1:8888/rest/$1
ProxyPassReverse / http://127.0.0.1:8888/
</IfModule>
mod_cfml is loaded in httpd.conf file
LoadModule modcfml_module modules/mod_cfml.so
CFMLHandlers ".cfm .cfc .cfml"
ModCFML_SharedKey "{{ shared_key_here }}"
LogHeaders false
LogHandlers false
LogAliases false
VDirHeader false
In the end I restarted Lucee and Apache services and created a index.cfm file in /var/www/html, but when I try o access it I get a 503 error.
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Catalina.out logs from tomcat and error_logs from apache dont give me any hints on whats happerning.
Can anyone point me any direction to solve this?
Any additional info you may need in order to help me fell free to ask.
Thanks.
So I found that my machine had SE (Security Enhanced) enabled, and there was a setting that prevented the request to be correctly proxied to tomcat, which is httpd_can_network_connect.
I had to run /usr/sbin/setsebool httpd_can_network_connect true in order to make it work, after this and restarting httpd service, everything was ok!

Where is documentation of switch options for apache2ctl command?

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.

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

Can't Access to my Amazon Instance with public Ip

I have a new amazon instance EC2, and I want to build a Web Server so I did :
Install apache2
Install libapache2-mod-php5
a2enmod rewrite
Add a Http rule in the default group to allow all IP
add Directory AllowOverride All in /etc/apache2/sites-availables/ default-conf
But when I want to check if apache is running by typing the public ip of the instance in my browser, I dont have the basic index.html "it's works". I got nothing.
What does i missed ?
Thanks you.
If apache is running fine, then it might be the firewall.
In the AWS console, make sure you have unblocked port 80 in the "Security Groups" under "Network & Security".
I found the solution.
It was a problem with the firewall.
The security group that I changed was not the one that was linked with my Instance
My bad.
do you know if the apache is running? you can check with:
ps aux |grep -i 'http\|apache'
if it has not started, you can try:
/etc/init.d/httpd start

httpd running internally but not externally

I have a new server running CentOS, and it has httpd running on 192.168.1.100:80.
I can connect to my server through ssh on 192.168.1.100, but when I go to 192.168.1.100 in my browser, it says "Oops! Google Chrome could not connect to 192.168.1.100".
I also tried wget to see if that works, and here is where it gets interesting.
when I run:
wget 192.168.1.100
On my server it gets the index.html file as it should.
but when I run it on my laptop is says "Connecting to 192.168.1.100:80... failed: No route to host."
Does anyone know how to fix this?
Seems like your Apache configuration binds httpd to 192.168.1.100:80
Find line Listen 192.168.1.100:80 in Apache main configuration - something like /etc/httpd/httpd.conf or /etc/apache2/httpd.conf and change this line to Listen 0.0.0.0:80.
Restart Apache and it will probably work.