Jump to content

Apache deployment


Jim Gallagher

Recommended Posts

Since I had no luck with IIS, I switched over to Apache 2.2. I am getting a blue screen with "loading". Since my app is kind of complex I decided to simplify everything. The steps below are what I followed to deploy the simplest uniGui application possible. If anyone sees a problem with anything I've done, please let me know. I am new to web servers, so it is very likely I am doing something dumb. These are ALL the steps I followed:

 

 

 

 

 

CLIENT APP:

 

Using uniGui 0.86.0 build 889 Delphi XE.

 

 

1. I create a new application TestApp using the uniGui Wizard.

 

2. I select VCL Application/Standalone Server/ISAPI Module.

 

3. On the MainForm I place a TuniButton and in its onclick event I have: UniButton1.Caption := 'Hello world';

 

4. I change the Port in UniServerModule from 8077 to 80. I leave [ext]\ for extroot. I make no other changes to the program.

 

5. I hit F9, and it creates TestApp.exe and runs in VCL mode as expected. It runs from the browser (URL: 127.0.0.1) as expected.

 

6. To deploy, I change extroot to ext-x.y.z\ and set Standalone Server to True. I rebuild TestApp.exe

 

7. I comment out: {$define UNIGUI_VCL} and build the project again. I make no other changes. It creates TestApp.dll

 

 

SERVER DEPLOY

 

Apache 2.2, Windows Server 2008

 

1. I install Apache 2.2.

2. I create a ServiceUser windows ID and run the service using that ID.

3. Follow the instructions in on-line help:

a) LoadModule isapi_module modules/mod_isapi.so is already uncommented in my installed httpd.conf file

B) I add "AddHandler isapi-handler .dll" right after the commented AddHandler for CGI, which I leave commented.

c) I add, right *after* the default directory entry:

<Directory "C:/TestApp">

Options Indexes FollowSymLinks ExecCGI

AllowOverride None

Order allow,deny

Allow from all

</Directory>

 

d) I put: Alias /MyTestApp "C:/TestApp" in the <IfModule alias_module> section

4. I right click the c:\TestApp directory and give the ServiceUser ID full control. I also give that user

full control of the Apache server directory.

5. I copy the ext-3.3.0 directory to C:\TestApp

6. I place TestApp.exe and TestApp.dll in the C:\TestApp directory.

7. I stop the Apache service

8. I run TestApp.exe. It works as expected. If I use 127.0.0.1, or my URL I get the TestApp with the button.

9. I stop TestApp.exe and start the Apache service.

10. I enter 127.0.0.1 and I get the default htdocs/index.html

11. I enter 127.0.0.1/MyTestApp and I get the index.html file I have placed in c:\TestApp. So the alias is working

12. I enter 127.0.0.1/MyTestApp/TestApp.dll and I get a blue screen with "loading". These are the error and access logs:

 

 

ACCESS.LOG

127.0.0.1 - - [12/Oct/2011:10:38:32 -0700] "GET / HTTP/1.1" 200 65

127.0.0.1 - - [12/Oct/2011:10:38:32 -0700] "GET /favicon.ico HTTP/1.1" 404 209

127.0.0.1 - - [12/Oct/2011:10:38:52 -0700] "GET /MyTestApp HTTP/1.1" 301 235

127.0.0.1 - - [12/Oct/2011:10:38:52 -0700] "GET /MyTestApp/ HTTP/1.1" 200 60

 

ERROR.LOG

 

[Wed Oct 12 10:38:14 2011] [notice] Child 40868: Child process is running

[Wed Oct 12 10:38:14 2011] [notice] Child 40868: Acquired the start mutex.

[Wed Oct 12 10:38:14 2011] [notice] Child 40868: Starting 64 worker threads.

[Wed Oct 12 10:38:14 2011] [notice] Child 40868: Starting thread to listen on port 80.

[Wed Oct 12 10:38:32 2011] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/favicon.ico

Link to comment
Share on other sites

I m going to guess that your testapp can not locate ext-3.3.0 directory. Try this when you build the dll

procedure TUniServerModule.UniGUIServerModuleCreate(Sender: TObject);

begin

extroot:='..\ext-3.3.0'; <==add this for the dll build

end;

 

on your server you should have a

c:\testapp

c:\ext-3.3.0

Link to comment
Share on other sites

Thanks, but no luck. It looks to me like the alias is not being transferred to the .dll environment, and everything is going to the default htdocs folder? Here's my error log, after making your suggested changes:

 

[Wed Oct 12 14:34:13 2011] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mytestapp, referer: http://127.0.0.1/MyTestApp/TestApp.dll

[Wed Oct 12 14:34:13 2011] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mytestapp, referer: http://127.0.0.1/MyTestApp/TestApp.dll

[Wed Oct 12 14:34:13 2011] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mytestapp, referer: http://127.0.0.1/MyTestApp/TestApp.dll

[Wed Oct 12 14:34:13 2011] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mytestapp, referer: http://127.0.0.1/MyTestApp/TestApp.dll

[Wed Oct 12 14:34:13 2011] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mytestapp, referer: http://127.0.0.1/MyTestApp/TestApp.dll

[Wed Oct 12 14:34:13 2011] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mytestapp, referer: http://127.0.0.1/MyTestApp/TestApp.dll

[Wed Oct 12 14:34:13 2011] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mytestapp, referer: http://127.0.0.1/MyTestApp/TestApp.dll

[Wed Oct 12 14:34:13 2011] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mytestapp, referer: http://127.0.0.1/MyTestApp/TestApp.dll

[Wed Oct 12 14:34:13 2011] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mytestapp, referer: http://127.0.0.1/MyTestApp/TestApp.dll

[Wed Oct 12 14:34:13 2011] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/mytestapp

 

 

 

I m going to guess that your testapp can not locate ext-3.3.0 directory. Try this when you build the dll

procedure TUniServerModule.UniGUIServerModuleCreate(Sender: TObject);

begin

extroot:='..\ext-3.3.0'; <==add this for the dll build

end;

 

on your server you should have a

c:\testapp

c:\ext-3.3.0

Link to comment
Share on other sites

When I had the same issue it all came down to the location of ext-3.3.0 and any custom scripts I may have included. Also make sure you use the ext-3.3.0 that came with the beta you are using. Your apache alias and directory seems to be correct. Also I found out that the DLL did not like absolute paths like c:\ext-3.3.0 but ..\ext-3.3.0 work for me.

Link to comment
Share on other sites

I do have the right ext folder, and it works well with the standalone server. I realized that I had forgotten to assign permissions to the Apache user to the root level ext-3.3.0 directory you recommended, but I just did that too, and still get the same error. I tried it with and without a trailing backslash. Is it possible that I should be using forward slashes, since it's somewhat interior to Apache? It appears that something is wrong in my environment, but I can't figure it out.

 

 

 

When I had the same issue it all came down to the location of ext-3.3.0 and any custom scripts I may have included. Also make sure you use the ext-3.3.0 that came with the beta you are using. Your apache alias and directory seems to be correct. Also I found out that the DLL did not like absolute paths like c:\ext-3.3.0 but ..\ext-3.3.0 work for me.

Link to comment
Share on other sites

Here is all the details:

I used XAMPP to install apache. Seems to be the easiest way.

This is what I have in httpd.conf

my application dll is xm.dll

I access is like this http://127.0.0.1/xm/ or http://127.0.0.1/xm/xm.dll

my applications is in C:\xampp\xm

my extjs is in C:\xampp\ext-3.3.0

In UniGUIServerModuleCreate I have this and is very important for the dll build

extroot:='..\ext-3.3.0';

 

Alias /xm c:/xampp/xm/

<Directory "c:/xampp/xm/">

AllowOverride None

Options ExecCGI

Order allow,deny

Allow from all

# SSLREquireSSL

</Directory>

<IfModule dir_module>

DirectoryIndex index.php index.php4 index.php3 index.cgi index.pl index.html index.htm index.shtml xm.dll index.phtml

</IfModule>

Link to comment
Share on other sites

Have you created an ALIAS for your application? What is the URL you're using to access your app?

 

Farshad, I realize that the first post in this thread is lengthy, but please read it and you will see that I have supplied all the details of everything I have done to try to get ISAPI to work under Apache. I created a "Hello World" uniGui application and described all the steps I followed in configuring Apache. I'm sure I've done something wrong, but I haven't heard yet what that is.

 

Yes, I created an Alias, MyTestApp, and the URL I used is 127.0.0.1/MyTestApp/TestApp.dll, as I described in the first post in this thread.

 

-Jim

Link to comment
Share on other sites

Thanks,

 

I'll try uninstalling Apache and re-installing with XAMPP, following your structure and see if that gets it working. I don't really need some of the stuff in XAMPP, but it's worth a try if it will get me up and running. It will probably be a few days before I can get to that.

 

-Jim

 

 

 

 

 

Here is all the details:

I used XAMPP to install apache. Seems to be the easiest way.

This is what I have in httpd.conf

my application dll is xm.dll

I access is like this http://127.0.0.1/xm/ or http://127.0.0.1/xm/xm.dll

my applications is in C:\xampp\xm

my extjs is in C:\xampp\ext-3.3.0

In UniGUIServerModuleCreate I have this and is very important for the dll build

extroot:='..\ext-3.3.0';

 

Alias /xm c:/xampp/xm/

<Directory "c:/xampp/xm/">

AllowOverride None

Options ExecCGI

Order allow,deny

Allow from all

# SSLREquireSSL

</Directory>

<IfModule dir_module>

DirectoryIndex index.php index.php4 index.php3 index.cgi index.pl index.html index.htm index.shtml xm.dll index.phtml

</IfModule>

Link to comment
Share on other sites

  • Administrators

Farshad, I realize that the first post in this thread is lengthy, but please read it and you will see that I have supplied all the details of everything I have done to try to get ISAPI to work under Apache. I created a "Hello World" uniGui application and described all the steps I followed in configuring Apache. I'm sure I've done something wrong, but I haven't heard yet what that is.

 

Yes, I created an Alias, MyTestApp, and the URL I used is 127.0.0.1/MyTestApp/TestApp.dll, as I described in the first post in this thread.

 

-Jim

 

Yes, but for unknown reasons your Apache server doesn't recognize your Alias and it is trying to access your DLL from wrong folder.

Link to comment
Share on other sites

Sounds good. I've attached my TestApp program that just contains a button whose caption changes when you click it. It runs for me as a VCL app, and as a standalone server if I place the executable on my server in c:\TestApp and copy the ext-3.3.0 subdirectory to the c:\TestApp directory. To create a DLL, I just comment out the first line.

 

 

Let's do it this way:

 

Attach your "hello world" app.

I'll setup it up in Apache and publish all required steps here.

Link to comment
Share on other sites

Sounds good. I've attached my TestApp program that just contains a button whose caption changes when you click it. It runs for me as a VCL app, and as a standalone server if I place the executable on my server in c:\TestApp and copy the ext-3.3.0 subdirectory to the c:\TestApp directory. To create a DLL, I just comment out the first line.

 

 

Sorry, the attach didn't work - I'll try again.

testapp.zip

Link to comment
Share on other sites

  • Administrators

I have an existing Apache 2.2 installation on port 8080

 

In ServerModule:

ExtRoot -> 'ext-x.y.z\'
ServerRoot -> ''

 

I copied ext-3.3.0 folder to C:\testapp

 

I added below lines to httpd.conf

 

<Directory "C:/testapp">
Options Indexes FollowSymLinks ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>

Alias /test "C:/testapp"

 

Here is my URL:

http://localhost:8080/test/testapp.dll

 

App is working fine.

 

 

 

I think your problem is here.

 

d) I put: Alias /MyTestApp "C:/TestApp" in the section

 

Don't put the Alias inside section. Put it directly below the section as I did in my example above.

  • Upvote 1
Link to comment
Share on other sites

 

 

 

I think your problem is here.

 

 

 

Don't put the Alias inside <IfModule alias_module> section. Put it directly below the <Directory> section as I did in my example above.

 

I moved the Alias, but I'm still getting the same results. I think there are several possibilities:

 

1. uniGui program. I may not have made some change that is required for it to run as a DLL. This seems unlikely, since you took my test program and it works.

 

2. Apache configuration. I'm going to re-install Apache (XAMPP this time) and revert to the installed httpd.conf file, and start over. I'll try to get a little more educated about Apache.

 

3. Windows Server 2008 configuration. Since the default Apache website is being served when requested, the basic functionality is there, but there may be some configuration required to enable ISAPI to work. This seems like the most likely problem to me, since I also couldn't get IIS to work.

 

I'll let you know if I make any progress, though I'm going to have to spend less time on this for the next week or so.

 

Thanks to all for your help.

 

-Jim

Link to comment
Share on other sites

Is your server remotely accessible from internet? I may connect and try to see what's going on.

 

That's too much for me to ask, but since you offered <g>....

 

I don't have your email address, so if you email me at

 

zenia

@

earthlink

.

net

 

(without the linefeeds obviously) I can send you the credentials for .rdp logging in.

 

I realize that fixing a novice's configuration problems is outside your responsibility, but if you can find the time I'd be grateful. If it isn't an easy, obvious fix and is taking too much of your time just let it go, and I'll get it figured out eventually.

 

Thanks,

 

 

-Jim

Link to comment
Share on other sites

  • Administrators

That's too much for me to ask, but since you offered ....

 

I don't have your email address, so if you email me at

 

zenia

@

earthlink

.

net

 

(without the linefeeds obviously) I can send you the credentials for .rdp logging in.

 

I realize that fixing a novice's configuration problems is outside your responsibility, but if you can find the time I'd be grateful. If it isn't an easy, obvious fix and is taking too much of your time just let it go, and I'll get it figured out eventually.

 

Thanks,

 

 

-Jim

 

I'll try to be helpful as long as I can. My other object is to see if we miss something on uniGUI side when Apache server is involved.

Link to comment
Share on other sites

  • Administrators

I could find the problem. Apache is case-sensitive and Alias should be called exactly as declared. uniGUI internally converts URL paths to lowercase and as a side effect all internal URLs are inaccessible from Apache. Issue logged as #1146 and fixed.

 

Workaround:

 

Don't use uppercase characters in your Alias.

Link to comment
Share on other sites

Farshad,

 

That fixes it! Thanks so much for taking the time to track this down. My test app now works, but more importantly, the real app I'm working on is also working correctly.

 

Thanks again, and I'm really looking forward to the release version.

 

-Jim

 

 

 

I could find the problem. Apache is case-sensitive and Alias should be called exactly as declared. uniGUI internally converts URL paths to lowercase and as a side effect all internal URLs are inaccessible from Apache. Issue logged as #1146 and fixed.

 

Workaround:

 

Don't use uppercase characters in your Alias.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...