Virtual Host配置過程
這里例子中我們的路徑為這樣
DocumentRoot: /home/jb51 /sites/demo.Vevb.com
ServerName:demo.Vevb.com
1.進(jìn)入apache虛擬主機(jī)設(shè)置目錄
cd /etc/apache2/sites-available |
2.創(chuàng)建文件demo.Vevb.com
<VirtualHost *:80> ServerAdmin webmaster@localhost DirectoryIndex index.html index.php DocumentRoot /home/jb51 /sites/demo.Vevb.com ServerName demo.Vevb.com ServerAlias demo.Vevb.com <Directory "/home/jb51 /sites/demo.Vevb.com"> allow from all Options + Indexes </Directory> </VirtualHost> |
3.激活虛擬主機(jī)配置
sudo a2ensite demo.Vevb.com |
4.進(jìn)入 /etc/apache2/sites-enabled/目錄,可以查看所有激活的虛擬主機(jī)??梢杂?sudo a2dissite demo.Vevb.com 注銷
cd /etc/apache2/sites-enabled ls -lt |
顯示
5.重啟apache服務(wù)
sudo /etc/init.d/apache2 restart |
6.ubuntu 設(shè)置host
vim /etc/hosts |
127.0.0.1 demo.Vevb.com |
7.<Directory>設(shè)置開啟.htaccess與顯示目錄結(jié)構(gòu)列表
<Directory "/home/jb51 /demo.Vevb.com"> AllowOverride none AllowOverride all Options -Indexes FollowSymLinks </Directory> |
AllowOverride none 表示關(guān)閉.htaccess,如要開啟可設(shè)置為AllowOverride all
Options -Indexes 表示關(guān)閉目錄結(jié)構(gòu)顯示,如要開啟可設(shè)置為 Options Indexes
Options FollowSymLinks 表示支持symbol link(軟連接),如要關(guān)閉可設(shè)置為Options -FollowSymLinks
rewrite模塊重要參數(shù)說明
開啟rewrite:
sudo a2enmod rewrite |
停用rewrite:
sudo a2dismod rewrite |
服務(wù)器環(huán)境變量:Apache提供給rewirte模塊的環(huán)境變量大概分成5個(gè)類型.
第一部分: HTTP headers 部分參數(shù)
1.參數(shù)名稱: HTTP_USER_AGENT
樣例參考值: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8
說明: 相當(dāng)于PHP中的服務(wù)器參數(shù): $_SERVER["HTTP_USER_AGENT"]
2.參數(shù)名稱: HTTP_REFERER
樣例參考值: http://www.test.cn/test.php
說明: 相當(dāng)于PHP中的服務(wù)器參數(shù): _SERVER["HTTP_REFERER"]
3.參數(shù)名稱: HTTP_COOKIE
樣例參考值: ZDEDebuggerPresent=php,phtml,php3
說明: 相當(dāng)于PHP中的服務(wù)器參數(shù): $_SERVER["HTTP_COOKIE"]
4.參數(shù)名稱: HTTP_FORWARDED
新聞熱點(diǎn)
疑難解答
圖片精選