You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Vinay Purohit <Vi...@trianz.com> on 2008/03/31 09:07:49 UTC

[users@httpd] LoadModule directive

HI,
 
Can I have LoadModule directive inside the virtual server block in
httpd.conf  i.e
 
<VirtualHost *:100>

    DocumentRoot "C:/vhost"
    ServerName RuntimeTest1.apple.com
    LoadModule setenvif_module modules/myapp.so
#    ErrorLog logs/error.log
#    CustomLog CustomLog logs/access.log common
 
</VirtualHost>
 
So that it works only for RuntimeTest1.entrust.com's request and NOT for
other virtual servers.
 
\Vinay
 

Re: [users@httpd] LoadModule directive

Posted by Sascha Kersken <sk...@lingoworld.de>.
Hey,


> Hi,
> Thanks !! 

never mind :).

> I wrote myapp.so. Are you asking to change the implementation of
> myapp.so in such a way so that it reads some instruction in virtual host
> directive and take action upon. i.e 
> 
> I have following module in global part of httpd.conf
> 
> LoadModule my_module "C:\Program Files\Apple/bin/MyApp.so"
> 
> And I have fowwing two virtual host block (name based configuration)
> 
> <VirtualHost *:100>
>    DocumentRoot "C:/vhost1"
>    ServerName apple1.sun.com
> </VirtualHost>
> #
> # VirtualHost example:
> # Almost any Apache directive may go into a VirtualHost container.
> # The first VirtualHost section is used for requests without a known
> # server name.
> #
> 
> <VirtualHost *:100>
>      DocumentRoot "C:/vhost"
>      ServerName apple2.sun.com
> 	my_module on
> </VirtualHost>
> With above configuration I want every request
> http://apple2.sun.com/anything,html to be redirected to back-end while
> http://apple1.sun.com/anything.html should be given access directly.
> 
> Do I need to read "my_module on" and act upon ? I am not sure how to use
> "MyModulesFunction on"-style direcive you pointed in last email ? Please
> explain? It would be great if you have any example :-)

Yes, all your conclusions are right.
Feel free to read the following (English) tutorial I wrote for my 
(German) Apache textbook:

http://buecher.lingoworld.de/apache2/mod_daytime_en.html

In this tutorial, I explain how to write a module for the TCP daytime 
service; it reads a Virtual-Host-based configuration directive with on 
and off (or simply absent) values.


Regards
Sascha


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] LoadModule directive

Posted by Vinay Purohit <Vi...@trianz.com>.
Hi,
Thanks !! 
I wrote myapp.so. Are you asking to change the implementation of
myapp.so in such a way so that it reads some instruction in virtual host
directive and take action upon. i.e 

I have following module in global part of httpd.conf

LoadModule my_module "C:\Program Files\Apple/bin/MyApp.so"

And I have fowwing two virtual host block (name based configuration)

<VirtualHost *:100>
   DocumentRoot "C:/vhost1"
   ServerName apple1.sun.com
</VirtualHost>
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#

<VirtualHost *:100>
     DocumentRoot "C:/vhost"
     ServerName apple2.sun.com
	my_module on
</VirtualHost>
With above configuration I want every request
http://apple2.sun.com/anything,html to be redirected to back-end while
http://apple1.sun.com/anything.html should be given access directly.

Do I need to read "my_module on" and act upon ? I am not sure how to use
"MyModulesFunction on"-style direcive you pointed in last email ? Please
explain? It would be great if you have any example :-)

\Vinay

-----Original Message-----
From: Sascha Kersken [mailto:sk@lingoworld.de] 
Sent: Monday, March 31, 2008 3:20 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] LoadModule directive

Hey,


>  hi,
> Where do I do module specific settings ? Actually myapp.so(in example
> below) is a filter which redirects request to other custm build 
> application. I would like to redirect all the request of 
> RuntimeTest1.apple.com to custom application while other virtual host 
> ,configured name based virtual host , RuntimeTest2.apple.com should 
> work normally i.e. should not be redirected to my custom app.
> 
> \Vinay

If this myapp.so is a module you wrote yourself, you need to add a VHost
scope directive to switch the module's functionality on/off per Virtual
Host (most likely, the default would be that the module does nothing at
all and works only if it finds a "MyModulesFunction on"-style direcive).

If it's a third-party module you downloaded somewhere, refer to its
documentation.

One more side note: In your configuration, you load the module using

*LoadModule setenvif_module modules/myapp.so*

But setenvif_module is the official name of an Apache standard module,
so you should definitely use another module name.


Regards
Sascha


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] LoadModule directive

Posted by Sascha Kersken <sk...@lingoworld.de>.
Hey,


>  hi,
> Where do I do module specific settings ? Actually myapp.so(in example
> below) is a filter which redirects request to other custm build
> application. I would like to redirect all the request of
> RuntimeTest1.apple.com to custom application while other virtual host
> ,configured name based virtual host , RuntimeTest2.apple.com should work
> normally i.e. should not be redirected to my custom app. 
> 
> \Vinay

If this myapp.so is a module you wrote yourself, you need to add a VHost 
scope directive to switch the module's functionality on/off per Virtual 
Host (most likely, the default would be that the module does nothing at 
all and works only if it finds a "MyModulesFunction on"-style direcive). 
If it's a third-party module you downloaded somewhere, refer to its 
documentation.

One more side note: In your configuration, you load the module using

*LoadModule setenvif_module modules/myapp.so*

But setenvif_module is the official name of an Apache standard module, 
so you should definitely use another module name.


Regards
Sascha


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] LoadModule directive

Posted by Vinay Purohit <Vi...@trianz.com>.
 hi,
Where do I do module specific settings ? Actually myapp.so(in example
below) is a filter which redirects request to other custm build
application. I would like to redirect all the request of
RuntimeTest1.apple.com to custom application while other virtual host
,configured name based virtual host , RuntimeTest2.apple.com should work
normally i.e. should not be redirected to my custom app. 

\Vinay

-----Original Message-----
From: Sascha Kersken [mailto:sk@lingoworld.de] 
Sent: Monday, March 31, 2008 2:11 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] LoadModule directive

Hello,


> HI,
>  
> Can I have LoadModule directive inside the virtual server block in 
> httpd.conf  i.e
>  
> <VirtualHost *:100>
> 
>     DocumentRoot "C:/vhost"
>     ServerName RuntimeTest1.apple.com
>     *LoadModule setenvif_module modules/myapp.so*
> #    ErrorLog logs/error.log
> #    CustomLog CustomLog logs/access.log common
>  
> </VirtualHost>

No, you can't:
http://httpd.apache.org/docs/2.2/mod/mod_so.html#loadmodule
says "Server config".
But usually you can configure what a module does or does not in each
context using the module's own configuration directives.


Regards
Sascha


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] LoadModule directive

Posted by Sascha Kersken <sk...@lingoworld.de>.
Hello,


> HI,
>  
> Can I have LoadModule directive inside the virtual server block in 
> httpd.conf  i.e
>  
> <VirtualHost *:100>
> 
>     DocumentRoot "C:/vhost"
>     ServerName RuntimeTest1.apple.com
>     *LoadModule setenvif_module modules/myapp.so*
> #    ErrorLog logs/error.log
> #    CustomLog CustomLog logs/access.log common
>  
> </VirtualHost>

No, you can't:
http://httpd.apache.org/docs/2.2/mod/mod_so.html#loadmodule
says "Server config".
But usually you can configure what a module does or does not in each 
context using the module's own configuration directives.


Regards
Sascha


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org