LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-14-2007, 12:15 AM   #1
sunethj
Member
 
Registered: Nov 2006
Posts: 97

Rep: Reputation: 16
passing NameVirtualHost as a variable


I have my virtual host configuration files in conf/virtualconf/ directory with .conf extention. I want to pass the NameVirtualHost value in httpd.conf file to the <VirtualHost "ip"> directive given in each .conf file.

Please help. Thanks in advance.
 
Old 05-14-2007, 03:12 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
really don't follow... normally these days the main httpd.conf references another directory, like /etc/httpd/conf.d/ which contains seperate individual files which are all loaded into the main config. is that not what you're really after?
 
Old 05-14-2007, 03:32 AM   #3
sunethj
Member
 
Registered: Nov 2006
Posts: 97

Original Poster
Rep: Reputation: 16
Thanks for quick reply. In my main httpd.conf file i have the entry "NameVirtualHost <ip>". In my virtual configuration files also I have put the <ip> in the VirtualHost directive.

So what i want is a way to put the main "NameVirtualHost <ip>" as a variable and call it in side virtual host conf files.

Ex: in httpd.conf ==> NameVirtualHost 192.168.10.1

in all virtual host conf files ==><VirtualHost $NameVirtualHost>

This way when i am replicating theses to another server (having a different IP address I don't want to change the IPs in each individual conf file.
 
Old 05-14-2007, 03:56 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
there's no such thing without doing some sort of preprocessing of your own. can you not just use a * instead of the ip address?
 
Old 05-15-2007, 01:44 AM   #5
sunethj
Member
 
Registered: Nov 2006
Posts: 97

Original Poster
Rep: Reputation: 16
Addning * always return the default site (first one).

acid_kewpie, what did you mean by "sort of preprocessing"?

thanks.
 
Old 05-15-2007, 01:51 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
preprocessing...

cat myhttpd.conf | sed /__IPADDRESS__/192.168.0.1/g > /etc/httpd/conf/httpd.conf

and if * isn't working, you're not configuring it correctly...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ruby] Passing a variable to an email lmcilwain Programming 4 11-16-2006 08:05 PM
Perl question: Passing variable into function rjcrews Programming 0 10-06-2006 09:24 AM
Passing a variable to a cgi script WindowBreaker Slackware 1 04-03-2006 10:02 PM
passing command output to variable Infernal211283 Linux - Newbie 12 01-11-2006 05:54 AM
passing passing variable in Java as reference djgerbavore Programming 3 11-10-2004 02:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration