Following the instructions on Apache's site I have added the following to the end of my httpd.conf file:
RewriteEngine on
RewriteMap lowercase int:tolower
#define the map file
RewriteMap vhost txt:/web-data/vhost.map
# deal with aliases as above
RewriteCond %{REQUEST_URI} !^/icons/
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
# this does the file-based remap
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/httpdocs/$1
RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/cgi-bin/$1 [H=cgi-script]
When I run service httpd start
I get the following error:
RewriteMap: file for map vhost not found:/web-data/vhost.map
I've triple checked that the file is present, with read permissions, and that the spelling is correct in the reference. What could I be missing?
Edit
Results of ls -lZ
on /web-data/
drwxrwsr-x. root www unconfined_u:object_r:file_t:s0 logs
drwx------. root root system_u:object_r:file_t:s0 lost+found
-rw-r--r--. root www unconfined_u:object_r:file_t:s0 vhost.map
drwxrwsr-x. root www unconfined_u:object_r:file_t:s0 vhosts
/web-data/vhost.map
. If the relative path isn't working, try its absolute version./web-data/
is a root level directory so that is an absolute path.ls -lZ
on/web-data
(-Z
displays SELinux contexts)