Sample Header Ad - 728x90

How to replace apache directory config with sed?

2 votes
5 answers
373 views
I'm trying to replace a Directory option from apache configuration with sed replace command, but I cannot understand why it doesn't work; it changes nothing. What I'm missing? This is the config example: # Sets the default security model of the Apache2 HTTPD server. It does # not allow access to the root filesystem outside of /usr/share and /var/www. # The former is used by web applications packaged in Debian, # the latter may be used for local directories served by the web server. If # your system is serving content from a sub-directory in /srv you must allow # access here, or in any related virtual host. Options FollowSymLinks AllowOverride None Require all denied AllowOverride None Require all granted Options Indexes FollowSymLinks AllowOverride None Require all granted And this is my sed command, which unfortunately makes no changes: sed -E 's/()/\1All\2/' /etc/apache2/apache2.conf (-i option is missing for testing purposes) My goal is to set AllowOverride All only to `` sentence.
Asked by Tobia (131 rep)
May 29, 2025, 07:47 AM
Last activity: Jul 15, 2025, 08:35 AM