Portál AbcLinuxu, 12. května 2025 18:20
LoadModule vhost_alias_module /usr/lib/modules/mod_vhost_alias.so
# get the server name from the Host: header
UseCanonicalName Off
# splittable logs
LogFormat "%{Host}i %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon
< Directory /www/hosts>
# ExecCGI is needed here because we can't force
# CGI execution in the way that ScriptAlias does
Options FollowSymLinks ExecCGI
< / Directory>
# now for the hard bit
RewriteEngine On
# a ServerName derived from a Host: header may be any case at all
RewriteMap lowercase int:tolower
## deal with normal documents first:
# allow Alias /icons/ to work - repeat for other aliases
RewriteCond %{REQUEST_URI} !^/icons/
# allow CGIs to work
RewriteCond %{REQUEST_URI} !^/cgi-bin/
# do the magic
RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/docs/$1
## and now deal with CGIs - we have to force a MIME type
RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/cgi-bin/$1 [T=application/x-httpd-cgi]
# that's it!
a pri restartu apache to hlasi toto:
demon:~# /etc/init.d/apache2 restart Forcing reload of web server: Apache2 ... failed! You may still have some apache2 processes running. There are processes named 'apache2' which do not match your pid file, and in the name of safety, we've left them alone. Please review the situation by hand. Syntax error on line 18 of /etc/apache2/httpd.conf: Invalid command 'RewriteEngine', perhaps mis-spelled or defined by a module not included in the server configuration
LoadModule mod_rewrite
nebo jak se to píše ... - nepomůže ?
/etc/init.d/apache2 start
?
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.