LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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
 
LinkBack Search this Thread
Old 12-19-2009, 06:37 PM   #1
BassKozz
Member
 
Registered: Dec 2008
Distribution: Ubuntu 8.10
Posts: 35

Rep: Reputation: 15
Programatically change AllowOverride for <Directory /var/www/>


How can I progamatically (using BASH) change AllowOverride for <Directory /var/www/> from 'None' to 'All' ?

Rather then having to manually edit /etc/apache2/sites-enabled/000-default

Normally I could just use:
Code:
sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/sites-enabled/000-default
However my 000-default file has other AllowOverride directives that I don't want to change:
Code:
NameVirtualHost *
<VirtualHost *>
 ServerAdmin webmaster@localhost

 DocumentRoot /var/www/
 <Directory />
  Options FollowSymLinks
  AllowOverride None
 </Directory>
 <Directory /var/www/>
  Options Indexes FollowSymLinks MultiViews
  AllowOverride All
  Order allow,deny
  allow from all
 </Directory>

 ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
 <Directory "/usr/lib/cgi-bin">
  AllowOverride None
  Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
  Order allow,deny
  Allow from all
 </Directory>

 ErrorLog /var/log/apache2/error.log

 # Possible values include: debug, info, notice, warn, error, crit,
 # alert, emerg.
 LogLevel warn

 CustomLog /var/log/apache2/access.log combined
 ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
For example I don't want AllowOverride on / or /usr/share/doc or /usr/lib/cgi-bin

I just want it set on <Directory /var/www/>
p.s. I am on Ubuntu-Server 8.04.

Last edited by BassKozz; 12-19-2009 at 06:44 PM.
 
Old 12-20-2009, 06:00 PM   #2
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,695
Blog Entries: 5

Rep: Reputation: 239Reputation: 239Reputation: 239
use an address,
Code:
sed '/<Directory \/var\/www\/>/s/.......' /etc/apache2/sites-enabled/000-default
 
  


Reply

Tags
apache, apache2, bash, httpdconf


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I change the path of SuExec from /var/www to /home? jerryhost.info Linux - Newbie 2 08-08-2009 09:39 AM
Directory index forbidden by rule: /var/www/html/ danimaldaisy Linux - Networking 6 02-11-2008 01:32 AM
Debian 3.1 sarge, Apache and /var/www/images directory fiddelm3742 Linux - Software 7 06-30-2005 11:02 AM
apache server setup and how to place files in the var/www/html directory dramous Linux - General 2 09-25-2004 01:29 AM
Giving a user CHMOD rights to the /var/www/html directory? scubes13 Linux - Networking 3 08-18-2002 03:38 PM


All times are GMT -5. The time now is 08:09 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration