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
Best Answer
Compare the output of
ls -lZ /var/www/html
andls -lZ /web-data
. Also, examine your syslog, there should be a corresponding SELinux error with details.In the interim, try the following:
Change the context of
/web-data
to match that of/var/www/html
using thechcon
command, something like:chcon --reference=/var/www/html /web-data
Discouraged: You can also temporarily disable SELinux and see if the error goes away