I’ll explain in this article how to setup Apache and the configuration of Apache to setup a web server. I’ll setup Apache with Tomcat, Glassfish, Hudson, Subversion, PHP and Joomla. It’s a quick guide how to setup everything, you could have to change some settings to reflect your configuration.
Take a look of the applications that will be installed
- Apache
- Php
- PhpMyAdmin
- MySQL
- Glassfish
- Tomcat
- Subversion
- Hudson
- Joomla
First, We will have to download the applications. (Only download what you need).
Download applications
Apache
To simplify the installation and configuration process, I’ll use an “all in one” setup : xampp. You can download it here.
Tomcat
If you need Tomcat 6.0.14 , you can download the addon for xampp here , or download it from Jakarta here.
If you want Tomcat or Glassfish you will need a JDK. You can use the latest JDK 6 here or try JDK 7 here.
Glassfish
You can download binaries of Glassfish from here or the latest version from svn. (If you want to do this step, you will need Maven 2.0.7 here). There is a really good procedure from Sun here for building from the sources.
Hudson
You can download it here.
Subversion
Subversion server can be download from here. We will need an addon for Apache, that can be download here.
Joomla
To download Joomla go here.
Installation and configuration
Apache
When you use the installer from xampp, it’s very easy to install. Just follow the wizard. When the installation is done, you need to change the default security settings. Follow this guide.
You could have to modify httpd.conf if you install the others applications. I’ll explain it in the appropriate application’s configuration.
Tomcat
Once you have installed Tomcat, you need to configure Apache to redirect the Url to Tomcat. You need to activate the module mod_jk in httpd.conf of Apache. (If you used the Tomcat module for xampp, it will be already activated).
Add this line at the end of httpd.conf :
Include conf/extra/mod_jk.conf
and create the file if is not there and put this in the file.
<IfModule !mod_jk.c>
LoadModule jk_module modules/mod_jk.so
</IfModule>
<IfModule mod_jk.c>
JkWorkersFile “C:/www/tomcat/conf/workers.properties”
JkLogFile “C:/www/tomcat/logs/mod_jk.log”
JkLogLevel info
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# Alias /examples “C:/www/tomcat/webapps/examples”
#<Directory “C:/www/tomcat/webapps/examples”>
# Options All
# </Directory>
# here it’s the url that will be forwarded to tomcat
JkMount /*.jsp ajp13
JkMount /examples/* ajp13
</IfModule>
Please take a look at the line :
JkWorkersFile “C:/www/tomcat/conf/workers.properties”
This line is the configuration for the module in Tomcat. You configure the port, load balancing… (Tomcat have a complete documentation with example here). Tomcat have a “auto config” if you want to keep it simple.
here a sample
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
Subversion
I recommend that you start by reading this good guide.
You will have to edit the httpd.conf of Apache.
Add theses lines at the end : (don’t forget the replace settings that represent your setup)
# Subversion
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svnrepository>
DAV svn
SVNPath “c:/www/Subversion/repository”
#SVNParentPath “c:/www/Subversion/repository”
#SVNIndexXSLT “c:/www/Subversion/repository/svnindex.xsl”
SVNAutoversioning on
</Location>
I suggest to install a Subversion client, it will be easier to configure and create repositories. I use TortoiseSvn and Eclipse (SVN plugin).
Joomla
To install Joomla, it’s really simple. Unzip the installation file into the document root of Apache (if you don’t know, check the for the line : DocumentRoot in httpd.conf).
After that, start a browser and enter this URL (need to reflect your configuration) :
http://localhost:80/joomla/
you will be forwared to the Joomla Setup. Just follow the wizard, and when your setup is completed, you will have to delete the folder …/Joomla/installation
Glassfish
To install Glassfish, you have multiples options. I’ll recommend the easiest way for your first time. Install the Glassfish with the Installer, just follow the wizard. Don’t forget.. You need the JDK for that.. not the JRE!
If you prefer bulding Glassfish from the sources, you can follow this excellent guide.
You can configure Glassfish in Apache using mod_jk (like Tomcat) or use mod_proxy.
If you use mod_jk, you won’t use the full connectivity power of Glassfish, but it will works. I’ll explain how to configure both of them. Just for your information, I prefer the mod_proxy config.
Mod_jk setup
Please read the config for Tomcat in this article and go to this post from Jean-Francois Arcand here.
This procedure works for Glassfish 2.1. At this moment, it doesn’t work for the latest version of Glassfish. There is a open bug for that.
And your need to log into the Glassfish console admin. Go into the section : Application Server, JVM Setting. Add this line :
-Dcom.sun.enterprise.web.connector.enableJK=8009
Mod_proxy setup
Open httpd.conf of Apache and add theses lines at the end :
LoadModule proxy_html_module modules/mod_proxy_html.so
Include conf/proxy_html.conf
ProxyPreserveHost on
RewriteEngine on
# example of web application installed on Glassfish
#RewriteRule ^/hudson$ /hudson/ [R,L]
#RewriteRule ^/hudson/(.*) http://localhost:8888/hudson/$1 [P,L]
you can get the file : conf/proxy_html.conf
ADMIN GUI
It’s possible that you don’t have the admin gui console bundle with your installation. You will need to install it. You can let Glassfish auto-install it for you (Recommended), or install it yourself. Right now there is a bug on the build that I’m testing, so I have to install it myself. I’ll describe the both ways.
Auto-install
Enter the URL : http://localhost:8080 (it the port you choose). You should get a welcome page : Your Application Server is now running. Click on the link : To manage the server, click here. You will be redirect to : http://localhost:8080/admin
it the console is not install, you will be able to install it from there, just follow the steps. Like I said, I’m not able to install it from there, so is you are in the same situation.. go to the next step.
Manually
Download the admin.war from Glassfish site. You can have the latest promoted test build here : http://download.java.net/glassfish/v3/admingui/
Once you have downloaded the war..
copy it in the folder glassfish/bin
open a command line : asadmin deploy -p 8080 admingui-v3-prelude-b20.war
that will install it and it will be accessible with this link : http://localhost:8080/admingui-v3-prelude-b20/
Hudson
To install Hudson into Glassfish it’s really easy. Log into the Glassfish admin console or by command line.
You can deploy the war with the command line, like the Glassfish admin gui installation or use GF admin to deploy it. I prefer the Gui. Open Glassfish admin and click on Deploy war application. Click on browse and followed by OK. That it. The application will start automaticaly. You will be able to access it by : http://localhost:8080/hudson
PS. There is a bug in the admin gui. If your port is not 8080, when you click on the “launch” link for an application, it won’t use your custom port. It will open it using the port 8080, that you will have th edit the URL to reflect your port. That should be fixed in V3.