bannkreis.de

Faint idea to published website. An OpenWGA Tutorial, Part 3

Page 3 of 3

Setup publishing

Now that technically your app is on your live server and available to the public there are still some binding parts missing:

  • OpenWGA is published on port 8080 but websites normally are accessed via port 80 (which is the port your browser uses when you omit the colon part). We need to server it there
  • To access your app you need to specify the app name in the URL. Your app however should come up just when your server is addressed without any extra path.

Let's see how we solve that.

The port problem

Which is this: Only the root user of Linux systems is allowed to answer on ports from 0 to 1024, so in order to do so on port 80 OpenWGA would need to be run as root user. Any linux admin will tell you this is a bad idea as the root user should really be reserved for administrative operations. That is why OpenWGA is run by its own "openwga" user and listens to port 8080 instead.

So how to solve this? Normally this is done by setting up a pure HTTP server - mostly Apache - on the machine, which will listen to port 80 (although not being run by root, but that is a different topic). Then this server is configured to forward any/some requests to OpenWGA (which actually is an Apache Tomcat Server running the OpenWGA application for that matter).

There are numerous tutorials on the web how to do this. However lets try to sum things up at least for the Debian that I am using. An Apache server is most likely already running on your box (try http://your-server-dns-or-ip without port to see, should come up with a page saying "It works!"), so we just need to setup the binding part.

1. Enable mod_proxy and mod_proxy_ajp, optional Apache modules to perform the routing.

These are most likely also already installed but inactive. There is a nice command line toolie for this. On console enter:

a2enmod proxy

a2enmod proxy_ajp

2. Configure mod_proxy

On your server in folder "/etc/apache2/sites-enabled" there should be a file "000-default", denoting the default configuration for publishing on your Apache server. Open it with nano:

nano /etc/apache2/sites-enabled/000-default

The contents will look like this:

<VirtualHost *:80>

        ServerAdmin webmaster@localhost


        DocumentRoot /var/www

        <Directory />

                Options FollowSymLinks

                AllowOverride None

        </Directory>


        ....


</VirtualHost>

Directly under the "ServerAdmin" line add the following content:

<Proxy *>

 AddDefaultCharset Off

 Order deny,allow

 Allow from all

</Proxy>


ProxyPass / ajp://localhost:8009/

ProxyPassReverse / ajp://localhost:8009/ 

This will tell Apache to route all requests on to OpenWGA which listens on localhost port 8009.

There are many things in this file which are now ineffective, as Apache normally is configured to publish HTML files on the servers file system but these are now unreachable. You may keep these config lines, they do not hurt. I for myself have deleted all the lines in there that refer to publishing, like the <Directory/> blocks and anything talking about "Script" and "Alias" and the such. I only kept the lines configuring logs.

3. Restart Apache

Were almost done. Issue the following command restarting the Apache server:

/etc/init.d/apache2 restart

After that try to call the page under "http://your-server-dns-or-ip" via Browser, which previously told you "It works!". It should now show the OpenWGA start page.

You are still able to access your OpenWGA server via port 8080, which is of some value, as you might want to make that one unaccessible to the public via firewall and then deny administrative operations on any other port, or just to tell if a problem is caused by OpenWGA itself or rather the Apache server). 

Configure the OpenWGA virtual host

That part will again be solvable inside OpenWGA. Fire up the admin client in your browser and head in the menu to "Configuration > Virtual Hosts". (If using an older version of OpenWGA you might need to enable the "Expert mode" via the checkbox to the top right to see this).

This part of the UI should show you a (currently empty) list of virtual host configuations. Hit the button "New virtual host" to add one:

screenshot_02.png

This screenshot already shows the new configuration like it should be filled by you:

  • Field "Host name" takes DNS host names for which this virtual host should be responsible, so you can use different configurations for different DNS names of your server. We use "*" so this is responsible for all.
  • Field "Allowed databases" actually configures the apps that may be accessed on this virtual host. We currently have no reason to exclude any, so we change this to setting "All"
  • Field "Default database" (again) actually means the app that should be shown when any DNS name of this host is called without extra path. This is the "sweet spot" which we want to accomplish here, so we choose our just exported app from the list
  • You may want to check "hide default database in URL" if you do not want the database key of the default ... app (man, we really can't get used to our own new terminology, can we?) to be removed from any site URLs. I for myself are not a big fan of this feature so I leave it unchecked.

That's it. Click save now. Then again call http://your-server-dns-or-ip in your browser and let's see where it takes us now. I see the following:

screenshot_03.png

Sheer beauty, innit?

Done!

That's it, you now have exported your website to your new live server. Be proud of yourself!

This concludes this part of the tutorial. On the next (and most likely last) part we will see how we turn our OpenWGA live server into a "living system", where we can author content, change designs and the such. Stay tuned!

Enter Your Comment:

use markdown syntax

Author

About

Last comments

  • Oliver:
    Als Antwort auf "Anonym" vom 27. Dezember 2015 (..
  • anonym:
    Habbo als abzocke zu deklarieren finde ich schon..
  • anonym:
    Wenn du es dir leisten kannst und es dich glückl..
  • Jebote:
    ja sicher kommen alle auf diesen 5 jahre alten a..
  • Micha:
    @Ingo, na klar. Alles legitim und voll ok ;-) Mu..

Really currently consuming

Links

  • Mehr Whisky
  • Ich@last.fm
  • Ich@Twitter
  • Dina
  • Julia
  • Der Meister (nebst Frau Meister)
  • Rockender Webworker
  • Irgendwas mit Fischen