在 apache中配置Alias,如下格式
<VirtualHost *:80><br /> ServerAdmin webmaster@localhost<br /> DocumentRoot /var/www<br /> <Directory /><br /> Options FollowSymLinks<br /> AllowOverride None<br /> </Directory><br /> <Directory /var/www/><br /> Options Indexes FollowSymLinks MultiViews<br /> AllowOverride None<br /> Order allow,deny<br /> allow from all<br /> </Directory><br /> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/<br /> <Directory "/usr/lib/cgi-bin"><br /> AllowOverride None<br /> Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch<br /> Order allow,deny<br /> Allow from all<br /> </Directory><br /> ErrorLog ${APACHE_LOG_DIR}/error.log<br /> # Possible values include: debug, info, notice, warn, error, crit,<br /> # alert, emerg.<br /> LogLevel warn<br /> CustomLog ${APACHE_LOG_DIR}/access.log combined<br /> Alias /doc/ "/usr/share/doc/"<br /> <Directory "/usr/share/doc/"><br /> Options Indexes MultiViews FollowSymLinks<br /> AllowOverride None<br /> Order deny,allow<br /> Deny from all<br /> Allow from 127.0.0.0/255.0.0.0 ::1/128<br /> </Directory><br /> Alias /pics "/exports/flv12"<br /> <Directory "/exports/flv12"><br /> Options Indexes<br /> AllowOverride AuthConfig FileInfo<br /> Order allow,deny<br /> Allow from all<br /> </Directory><br /> Alias /videos "/exports/flv14"<br /> <Directory "/exports/flv14"><br /> Options Indexes<br /> AllowOverride AuthConfig FileInfo<br /> Order allow,deny<br /> Allow from all<br /> </Directory><br /></VirtualHost>
注意,要將httpd.conf的
User和Group設定為有許可權訪問Alias指向目錄。否則訪問會出現403 forbidden