192.168.1.13上安裝了apache服務,apache的根目錄下有站點1,根目錄下的site2目錄下有站點2
現有兩個域名透過代理指向192.168.1.13,一個域名作為站點2的域名,一個域名作為站點2的附件訪問域名。
在不修改設定檔時可以透過http://www.xpdent.cn/site2/in...方式存取網站2
<VirtualHost *:80>
ServerName www.xpdent.cn
ServerAlias www.xpdent.cn
Alias / /data/www/html/site2/
DocumentRoot /data/www/html/site2
DirectoryIndex index.html
</VirtualHost>
<VirtualHost *:80>
ServerName file.xpdent.cn
ServerAlias file.xpdent.cn
Alias / /data/www/html/site2/
DocumentRoot /data/www/html/site2
DirectoryIndex index.html
</VirtualHost>
發現在sites-availiable000-default.conf中增加以上配置後,www.xpdent.cn這個域名只能訪問站點2首頁,其他目錄和文件都不能訪問,報404錯誤。 http://www.xpdent.cn/ 可以訪問首頁http://www.xpdent.cn/index.php 報404錯誤不能訪問http://www.xpdent.cn/index.html 報404錯誤不能訪問
請問應該如何設定?
ServerAlias 是另外的域名,如果沒有就不用寫。
Alias可以去掉,DocumentRoot直接寫實際路徑。