Configure Apache Web server

Till now we were doing quite well using Apache Tomcat to serve our applications. Maybe the trouble was made by WPS not supporting .pdf files download, and maybe we would like to show our work to the rest of the world.  People are just not used to add port to URL or to append particular application name as subfolder instead of writing http://digmap-lab.yottabyte.hr:8080/DigMap/ one would write down only http://digmap-lab.yottabyte.hr/ and would be redirected to the right place. We can sort that out using Apache.

Proper Apache config would look like this:

cat /etc/httpd/conf/httpd.conf
NameVirtualHost *:80

<VirtualHost *:80>
 ServerName digmap-lab.yottabyte.hr

 RewriteEngine on
 RewriteCond %{REQUEST_URI} ^/$
 RewriteRule (.*) /DigMap/ [R=301]

 ProxyRequests Off
 ProxyPreserveHost On
 <Proxy *>
 Order deny,allow
 Allow from all
 </Proxy>
 ProxyPass / ajp://localhost:8009/
 ProxyPassReverse / ajp://localhost/
</VirtualHost>

<VirtualHost *:80>
 ServerName digmap-dme.yottabyte.hr
 DocumentRoot /var/www/html/digmap
</VirtualHost>

Restart Apache to apply changes

sudo service httpd restart

We assume to have folder that will share files:

su -
mkdir -p /var/www/html/digmap
chown -fR tomcat:apache /var/www/html/digmap
chmod ug+rw /var/www/html/digmap

Setting up DNS records

Add two new A records to DNS register:

digmap-dme.yottabyte.hr  A 89.201.163.99
digmap-lab.yottabyte.hr  A 89.201.163.99

I would recommend to use simple http://freedns.afraid.org/ for managing DMS record. Just for info, all physical and legal persons in Republic of Croatia have a right for their free domain like: krunoslav-hrnjak.from.hr or yottabyte.hr!

check out does it work properly:

nslookup digmap-dme.yottabyte.hr

nslookup digmap-dme.yottabyte.hr
Server: 85.114.32.7
Address: 85.114.32.7#53

Non-authoritative answer:
Name: digmap-dme.yottabyte.hr
Address: 89.201.163.99
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s