Archive<< May 2020 >>
- TMS WEB Core for Visual Studio Code beta is ready for TMS ALL-ACCESS users
- TMS VCL UI Pack 10.3 Major Update
- New Hands-on with Delphi book available now
- TMS WEB Core v1.4 beta is here for TMS ALL-ACCESS users
- TMS XData in a COVID-19 app: comments from the developer
- Extend TMS WEB Core with 40+ Smart HTML Elements
- Adrian Gallero (22)
- Bart Holvoet (3)
- Bernard Roussely (1)
- Bruno Fierens (246)
- Gjalt Vanhouwaert (5)
- Holger Flick (15)
- Marcos Douglas B. Santos (5)
- Masiha Zemarai (42)
- Nancy Lescouhier (32)
- Pieter Scheldeman (30)
- Roman Yankovsky (2)
- Tunde Keller (4)
- Wagner R. Landgraf (65)
BlogAll Blog Posts | Next Post | Previous Post
Tuesday, May 23, 2017This is part 3 of the tutorial on how to create TMS XData and TMS Sparkle servers on Linux. On Part 2, we have installed PAServer and launched our first "Hello, World" console application on Linux.
Here is video for part 3: Create and deploy an Apache module to Linux.
We will use WebBroker to create an empty Apache module. But first we need to install Apache on Linux.
1. Install Apache on Linux
On Linux terminal, use the following command to install Apache:
sudo apt-get install apache2
This should be enough to get Apache up and running. You can open your browser on Windows and just try to open the root page (let's consider our host name is "ubuntu" from now on):
And you should get a page from server telling you that Apache is running.
2. Create WebBroker Apache module in Delphi
Going back to Delphi, use menu option "File, New, Open...", then choose "Delphi Projects, WebBroker, Web Server Application".
Check "Linux" option, Next, and then select "Apache dynamic link module". When choosing the module name, type "xdata_module". Of course you can use any name you want, but we will use this name for further configuration in this tutorial. Finish the wizard and you will have the module created.
3. Build and deploy Apache module to Linux
Now build your Apache module (make sure to first select Linux64 platform in Project Manager, otherwise you would be building the module for Win32), and then click "Project, Deploy" menu option to deploy it to Linux. If you still have your PAServer running on Linux, it should send the module file to Linux.
The deployed file location should be something like this:
I might be slightly different in your Linux computer, because you might have used a different user name for Linux user, and a different user name/profile in your Windows machine (the "User-Ubuntu" part). You can simply use WinSCP from Windows to browse your Linux files and discover where is the .so file deployed by PAServer. You should find it by navigating from the PAServer folder created in your home directory.
4. Create Apache configuration files
We must now configure Apache to use our new module. On Linux terminal, go to Apache module configuration folder:
Create two new configuration files:
sudo touch xdata.conf sudo touch xdata.load
Edit the first file to load module (we will use Nano editor here, if you don't have it installed in your Linux, you can use command "sudo apt-get install nano"):
sudo nano xdata.load
Use the following content for xdata.load file. Here we must use the location where our .so module file was deployed, as we saw in step 3.
LoadModule xdata_module /home/user/PAServer/scratch-dir/User-Ubuntu/mod_xdata/libmod_xdata.so
Press Ctrl+X to save and exit from nano editor, and then let's edit xdata.conf file:
sudo nano xdata.conf
This should be the content of this file:
<Location /tms> SetHandler libmod_xdata-handler </Location>
Save that file as well, and Apache configuration is finished.
5. Enable Apache module
The configuration files we created are just a module that is "available". We should now enable the module using the following command:
sudo a2enmod xdata
6. Restart Apache
Now we should stop and restart Apache service. Use the following commands for that (we will use such commands very often further in next parts of this tutorial):
sudo apache2ctl stop sudo apache2ctl start
7. Test Apache module
Now we can go back to Windows, use our browser and go to the following url (remember to change "ubuntu" to the hostname or IP address of your Linux machine, if it's different):
And the browser should display "Web Server Application" as result.
In the next part we will learn how to add TMS Sparkle to the Apache module.
Wagner R. Landgraf
This blog post has received 1 comment.
All Blog Posts | Next Post | Previous Post