Instead of using ajp, I would recommend using mod_proxy. I have done that myself with great success. The way I have my stuff set up, I just configure a virtual domain to point to a directory, and create a .htaccess file as such:
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
Of course, alter to match your HTTP ports. In tomcat (which I use), I also edit in server.xml under conf. For the Connector on port 8080, I set the proxyName to match the virtual host, and the proxyPort to 80.
I should add a note that I am using dynamic virtual hosts for my configuration, my sites configuration (I am using debian) under /etc/apache2/sites-available looks as such:
<VirtualHost IP>
Servername yourdomain.com
ServerAlias *.yourdomain.com
UseCanonicalName Off
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog /var/www/yourdomain.com/logs/custom.log vcommon
ErrorLog /var/www/yourdomain.com/logs/error.log
TransferLog /var/www/yourdomain.com/logs/access.log
RewriteLog/var/www/yourdomain.com/logs/rewrite.log
RewriteLogLevel 2
VirtualDocumentRoot /var/www/yourdomain.com/sites/%1/html
VirtualScriptAlias /var/www/yourdomain.com/sites/%1/cgi-bin
LogLevel debug
<Directory /var/www/yourdomain.com/sites/>
AllowOverride All
</Directory>
</VirtualHost>
This means that stackoverflow.yourdomain.com will go to /var/www/yourdomain.com/sites/stackoverflow/html
I know you didn't ask for the last part, I just provided it to give a full overview off my setup, and how it fits into the .htaccess file with ProxyPass and ProxyPassReverse
this worked for me, when using varnish on port 80, serving apache from port 8000
with an additional apache Listen on port 8001 defined in
/etc/apache2/mods-enabled/status.conf
.
<IfModule mod_status.c>
#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Uncomment and change the ".example.com" to allow
# access from other hosts.
#
Listen 8001
ExtendedStatus On
<VirtualHost *:8001>
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost ip6-localhost
# Allow from .example.com
</Location>
</VirtualHost>
</IfModule>
you can test it with lynx
lynx -dump http://127.0.0.1:8001/server-status
the lynx output should look like something like this:
~
Apache Server Status for 127.0.0.1
Server Version: Apache/2.2.14 (Ubuntu) mod_ssl/2.2.14 OpenSSL/0.9.8k
Server Built: Nov 3 2011 03:29:23
__________________________________________________________________
Current Time: Saturday, 03-Dec-2011 12:36:05 CET
Restart Time: Friday, 02-Dec-2011 00:59:04 CET
Parent Server Generation: 22
Server uptime: 1 day 11 hours 37 minutes
Total accesses: 44550 - Total Traffic: 368.1 MB
CPU Usage: u27.53 s3.48 cu0 cs0 - .0242% CPU load
.347 requests/sec - 3010 B/second - 8.5 kB/request
2 requests currently being processed, 4 idle workers
W___._W.........................................................
--cut--
Best Answer
A standard Debian install of apache will have the following fragment of configuration:
This is telling apache to listen on port 80 and to listen to port 443 if mod_ssl is configured. In your case you'd want:
You need to make sure you run a restart, not a reload operation on apache for it to pay any attention to new Listen directives. The safest thing to do is to stop apache, make sure it is dead and start it again.
If this configuration does not work, check the log files for any error messages. You could use "netstat -lep --tcp" to see if there is anything listening on port 8080. Finally, if everything else doesn't work, try running apache under strace to see if it's trying to bind to that port and failing, but not logging the problem.