Sponsored Content
Full Discussion: Playing with httpd.conf
Top Forums Shell Programming and Scripting Playing with httpd.conf Post 302655549 by SilvesterJ on Wednesday 13th of June 2012 10:02:10 AM
Old 06-13-2012
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 Smilie

Thanks,
Silvester J

Last edited by pludi; 06-13-2012 at 11:18 AM..
 

10 More Discussions You Might Find Interesting

1. IP Networking

defaults httpd.conf

I have found in the httpd.conf where it it states the default parse pages like index.htm, index.html, index.php and etc....However, my computer box does not seem to want to automatically load the index.php files. Anyone have any ideas? (5 Replies)
Discussion started by: macdonto
5 Replies

2. IP Networking

httpd.conf - stumped

Have been asked to remove all images from being logged to the access_log ... where am I going wrong?<VirtualHost 123.456.789.99> ServerName www.somedomain.com.au DocumentRoot /agents/tts Redirect /wap http://somewap.com.au/traveler LogFormat "%v %h %l %u %t \"%r\" %>s %b" comonvhost... (2 Replies)
Discussion started by: Cameron
2 Replies

3. Ubuntu

Apache 2 httpd.conf empty

Hi everybody, I have installed Apache 2 + Tomcat 5.5. on Ubuntu 7.04 and the default httpd.conf is empty (0 lines), however there is a file called apache2.conf that looks like a default httpd.conf. I didn't use Apache in ages, since 1.3.x release, but I remember that the httpd.conf by default... (2 Replies)
Discussion started by: sspirito
2 Replies

4. UNIX for Dummies Questions & Answers

Python & httpd.conf settings

Assuming I have the following entry in my httpd.conf file <Directory /usr/local/www/apache22/data> AddHandler python-program .py PythonHandler form.py PythonDebug On </Directory> am I allowed to set a reference to another python script such as myscript.py in the httpd.conf file, or can... (0 Replies)
Discussion started by: thumper
0 Replies

5. UNIX for Dummies Questions & Answers

Need to add a line to httpd.conf

Hi , Need to add a following line to many webserver configuration . ie. Need to make following entry in "LimitRequestLine 4000" in httpd.conf. Any ideas welcome Regards, logic0 (2 Replies)
Discussion started by: logic0
2 Replies

6. Web Development

servername in apache httpd.conf

I'd like to know if servername in apache httpd.conf is the machine name or domain name. If it is domain name like example.com, should it be registered before in use? (1 Reply)
Discussion started by: yzhang738
1 Replies

7. Red Hat

apache 2.2 httpd.conf

Hi, I was wondering if someone could help me out here. I am super-paranoid, so am trying to limit what PHP files can be executed on this server. I have a small list of files that I want to allow. The rest, deny. So I have base rule that denies all php files server-wide: order allow,deny ... (0 Replies)
Discussion started by: Lobster
0 Replies

8. Red Hat

apache 2.2 httpd.conf

Hi, I was wondering if someone could help me out here. I am super-paranoid, so am trying to limit what PHP files can be executed on this server. I have a small list of files that I want to allow. The rest, deny: <Files ~ "\.(php|php3)$"> order allow,deny deny from all </Files> I... (0 Replies)
Discussion started by: Lobster
0 Replies

9. UNIX for Dummies Questions & Answers

Locate which httpd.conf is used by Apache

What is the command to see what httpd.conf file is apache using. Apache is started. (1 Reply)
Discussion started by: galford
1 Replies

10. Red Hat

Httpd.conf Config?

hi is it possible ? explain tome about below items StartServers 8 MinSpareServers 10 MaxSpareServers 20 ServerLimit 4000 MaxClients 4000 MaxRequestsPerChild 4000 this is my servers 8gig ram & cpu 12 core... what cann i putting in order this ? tnx (1 Reply)
Discussion started by: mnnn
1 Replies
All times are GMT -4. The time now is 01:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy