Settings | Sign in | Sign up

There are currently 2 posts.

【Linux】apache下綁定子目錄

Floor 1 張樹人 1/2/11 22:42
用的是linux系統,關於apache綁定子目錄,只針對新手
  打開apache的配置文件httpd.conf,去掉LoadModule rewrite_module modules/mod_rewrite.so前面的#號
  第二步:打配置文件尾部加上
  RewriteEngine on
  RewriteMap lowercase int:tolower
  #定義映像文件
  RewriteMap vhost txt:/apache/vhost/vhost.map
  #處理變名
  RewriteCond %{REQUEST_URI} !^/ic****/
  RewriteCond %{REQUEST_URI} !^/cgi-bin/
  RewriteCond ${lowercase:%{SERVER_NAME}}
  這裡做基於文件的重新映射
  RewriteCond ${vhost:%1}
  RewriteRule ^/(.*)
  RewriteCond %{REQUEST_URI}
  RewriteCond ${lowercase:%{SERVER_NAME}}
  RewriteCond ${vhost:%1}
  RewriteRule ^/(.*)
  httpd-vhosts.conf文件是域名和空間映像的文件
  ServerAdmin webmaster@xxx.com //管理郵箱
  DocumentRoot /usr/local/apache/htdocs/grzz.com.cn/v //這個是綁定的V這個文件夾 
  ServerName v.xxx.com // 這個是域名,我用的二級域名
  DirectoryIndex index.php index.html //默認首頁
  //路徑
  Optional FollowSymLinks
  AllowOverride None
  Order allow,deny p7
  Allow from all
Floor 2 張樹人 1/2/11 22:42
還有一種方法,修改conf/extra/httpd-vhosts.conf
增加下面的內容:
<VirtualHost *:80>
     #email address
     ServerAdmin admin@localhost
     #webpath
     DocumentRoot "/usr/local/apache/htdocs/" (這個是綁定的子目錄)
     #url
     ServerName tieba.blue.cat
     #error log
     ErrorLog "logs/tieba.blue.cat-error.log"
     #request log
     CustomLog "logs/tieba.blue.cat-access.log" common
</VirtualHost>

這種是通過虛擬主機的方式來綁定子目錄,樓上的是通過重定向來綁定

Content converter:

Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.