Playing with httpd.conf | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Playing with httpd.conf

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-13-2012
SilvesterJ SilvesterJ is offline
Registered User
 
Join Date: Sep 2011
Last Activity: 29 September 2013, 4:34 AM EDT
Posts: 15
Thanks: 1
Thanked 1 Time in 1 Post
Playing with httpd.conf

Hello Guys !!

wanted to use SED to pull cout the full vertualhost entry for domain which is specified from command line

Like (IP base httpd.conf)

Code:
domain="ServerName takemewithyou.in"
sed -n '/<VirtualHost* $domain/,/<\/VirtualHost>/p'  httpd.conf



File can take to test is below



Code:
<VirtualHost *>
    ServerName server.localdomain.com
    DocumentRoot /usr/local/apache/htdocs
    ServerAdmin nux@gmail.com
    <IfModule mod_suphp.c>
        suPHP_UserGroup nobody nobody
    </IfModule>
</VirtualHost>

# DO NOT EDIT. AUTOMATICALLY GENERATED.  IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.

<VirtualHost 192.162.0.1:80>
    ServerName winlinuxadmins.com
    ServerAlias www.winlinuxadmins .com
    DocumentRoot /home/winlinux/public_html
    ServerAdmin webmaster@winlinuxadmins.com
    UseCanonicalName Off
    CustomLog /usr/local/apache/domlogs/winlinuxadmins.com combined
    CustomLog /usr/local/apache/domlogs/winlinuxadmins.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    ## User winlinux # Needed for Cpanel::ApacheConf
    <IfModule mod_suphp.c>
        suPHP_UserGroup winlinux winlinux
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        <IfModule !mod_ruid2.c>
            SuexecUserGroup winlinux winlinux
        </IfModule>
    </IfModule>
    <IfModule mod_ruid2.c>
        RUidGid winlinux winlinux
    </IfModule>
    ScriptAlias /cgi-bin/ /home/winlinux/public_html/cgi-bin/


    # To customize this VirtualHost use an include file at the following location
    # Include "/usr/local/apache/conf/userdata/std/2/winlinux/winlinuxadmins.com/*.conf"

</VirtualHost>

# DO NOT EDIT. AUTOMATICALLY GENERATED.  IF YOU NEED TO MAKE A CHANGE PLEASE USE THE INCLUDE FILES.

# SSL

<VirtualHost 192.162.0.1:80>
    ServerName rediffmail.com
    ServerAlias rediffmail .com 
    DocumentRoot /home/rediffma/public_html
    ServerAdmin webmaster@rediffmail.com
    ## User rediffma # Needed for Cpanel::ApacheConf
    <IfModule mod_suphp.c>
        suPHP_UserGroup rediffma rediffma
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        <IfModule !mod_ruid2.c>
           SuexecUserGroup rediffma rediffma
        </IfModule>
    </IfModule>
    <IfModule mod_ruid2.c>
       RUidGid rediffma rediffma
    </IfModule>
    CustomLog /usr/local/apache/domlogs/rediffmail.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    CustomLog /usr/local/apache/domlogs/rediffmail.com combined
    Options -ExecCGI -Includes
    RemoveHandler cgi-script .cgi .pl .plx .ppl .perl
</VirtualHost>

sed , awk perl any method to get output will help me

Thanks,
Silvester J

Last edited by pludi; 06-13-2012 at 10:18 AM..
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
apache 2.2 httpd.conf Lobster Red Hat 0 05-20-2011 01:52 PM
apache 2.2 httpd.conf Lobster Red Hat 0 05-20-2011 01:50 PM
How to edit httpd.conf jaineeraj Shell Programming and Scripting 1 03-06-2009 03:05 AM
Need to add a line to httpd.conf logic0 UNIX for Dummies Questions & Answers 2 07-30-2008 02:56 PM
defaults httpd.conf macdonto IP Networking 5 09-25-2001 05:21 PM



All times are GMT -4. The time now is 02:39 AM.