RE: Conditional in httpd.conf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 

> -----Original Message-----
> From: rank1seeker@xxxxxxxxx [mailto:rank1seeker@xxxxxxxxx] 
> Sent: Tuesday, July 14, 2009 2:17 PM
> To: users@xxxxxxxxxxxxxxxx
> Subject: RE:  Conditional in httpd.conf
> 
> That is exatly how do I do it now.
> But the point is that I've noticed how diif between:
> <VirtualHost *:80>
> 	... plain HTTP website
> </VirtualHost>
> 
> <VirtualHost *:443>
> 	... SSL website
> </VirtualHost>
> 
> for a SAME site, is jus a 3 lines.
> That is:
> SSLEngine On and path to key and cert file.
> 
> So, had a thought of excluding port from VH container and 
> leaving only IP, 
> like:
> <VirtualHost 5.5.5.5>
> 
> 
> SetEnvIf or any other, similar module, also wouldn't be able 
> to "hack" it 
> in this way?

No. When apache parses the config file, it just fills up a series of
data structures as it goes along, line by line. You can't get it to
build a whole new VH struct just based on an ENV.

To do conditional stuff like this, I would write a perl-script that
*generates* the VHs, eg:

foreach $port (80, 443) {
	$output .= "<VirtualHost *:$port>\n";
	$output .= getCommonDirectives();
	$output .= getSSLStuff()
		if ($port == 443);
	$output .= "<VirtualHost/>\n";
}	

Then you run the perl-script just before each apache restart (ie, add it
to the apachectl script)

Rgds,
Owen Boyle
Disclaimer: Any disclaimer attached to this message may be ignored. 


> 
> 
> 
> 
> ----- Original Message -----
> From: "Boyle Owen" <Owen.Boyle@xxxxxxxxxxxxx>
> To: <users@xxxxxxxxxxxxxxxx>
> Date: Tue, 14 Jul 2009 09:32:34 +0200
> Subject: RE:  Conditional in httpd.conf
> 
> > > -----Original Message-----
> > > From: rank1seeker@xxxxxxxxx [mailto:rank1seeker@xxxxxxxxx] 
> > > Sent: Tuesday, July 14, 2009 4:05 AM
> > > To: users@xxxxxxxxxxxxxxxx
> > > Subject:  Conditional in httpd.conf
> > 
> > First off, httpd.conf is a config file - think of it as a 
> data structure
> > like a hash-map. It is not a programming language and has 
> no conditional
> > capabilities.
> > 
> > > 
> > > I would like to achieve this:
> > > 
> > > <If port is 443...>
> > > 	
> > > 	Execute / Parse this....
> > > 	
> > > </If port is 443...>
> > 
> > The SSL VH is actually an independent port-based VH so this 
> is achieved
> > simply by the <VirtualHost> container. For example;
> > 
> > <VirtualHost *:80>
> > 	... plain HTTP website
> > </VirtualHost>
> > 
> > <VirtualHost *:443>
> > 	... SSL website
> > </VirtualHost>
> > 
> > Rgds,
> > Owen Boyle
> > Disclaimer: Any disclaimer attached to this message may be ignored. 
> > 
> > > 
> > > 
> > > What is valid Apache22 syntax for this?
> > > That is, if port is 443, then additional config rules shall apply.
> > > 
> > > 
> ---------------------------------------------------------------------
> > > 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@xxxxxxxxxxxxxxxx
> > >    "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> > > For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
> > > 
> > > 
> >  
> > This message is for the named person's use only. It may contain 
> confidential, proprietary or legally privileged information. If you 
> receive this message in error, please notify the sender 
> urgently and then 
> immediately delete the message and any copies of it from your system. 
> Please also immediately destroy any hardcopies of the message. 
> > The sender's company reserves the right to monitor all e-mail 
> communications through their networks.
> > 
> > 
> ---------------------------------------------------------------------
> > 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@xxxxxxxxxxxxxxxx
> >    "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> > For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
> > 
> > 
> 
> ---------------------------------------------------------------------
> 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@xxxxxxxxxxxxxxxx
>    "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
> 
> 

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux