以(yi)下配置的路徑以(yi)阿里(li)云提供的標準環境路徑為準,如果您另行(xing)安(an)裝,請根據實際安(an)裝(zhuang)路徑去找(zhao)到(dao)您(nin)的配置(zhi)文(wen)件進行配置。
假如我們需(xu)要在我們的網站(zhan)和一個test.com的域名,請進行如下類似的操作:
1.cd /alidata/server/httpd/conf/vhosts/ 找到您(nin)的(de)網站(zhan)配(pei)置文(wen)件,一(yi)般是您(nin)的(de)域名.conf,例(li)如域名是:,那就應該是。
2.vim 修(xiu)改這個配(pei)置文件,您應該(gai)會看到如下(xia)類似的配(pei)置內容:
<VirtualHost *:80>
DocumentRoot /www/web/www_test_com/public_html
ServerName www.test.com
ServerAlias
DirectoryIndex index.php
ErrorDocument 400 /errpage/400.html
ErrorDocument 403 /errpage/403.html
ErrorDocument 404 /errpage/404.html
CustomLog "/www/web_logs/www.test.com_access_log" common
ErrorLog "/www/web_logs/www.test.com_error_log"
php_admin_value open_basedir /www/web/www_test_com:/tmp
<IfModule mod_deflate.c>
DeflateCompressionLevel 7
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php
AddOutputFilter DEFLATE css js html htm gif jpg png bmp php
</IfModule>
</VirtualHost>
<Directory /www/web/www_test_com>
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
3.點擊字母“i”開始編輯文件,輸入(ru)內容:
<VirtualHost *:80>
DocumentRoot /www/web/www_test_com/public_html
ServerName www.test.com
ServerAlias test.com m.test.com
DirectoryIndex index.php
ErrorDocument 400 /errpage/400.html
ErrorDocument 403 /errpage/403.html
ErrorDocument 404 /errpage/404.html
CustomLog "/www/web_logs/www.test.com_access_log" common
ErrorLog "/www/web_logs/www.test.com_error_log"
php_admin_value open_basedir /www/web/www_test_com:/tmp
<IfModule mod_deflate.c>
DeflateCompressionLevel 7
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php
AddOutputFilter DEFLATE css js html htm gif jpg png bmp php
</IfModule>
</VirtualHost>
<Directory /www/web/www_test_com>
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
其中:
ServerName www.test.com 綁定(ding)的網站(zhan)域名
ServerAlias test.com m.test.com 綁(bang)定的(de)網站(zhan)別名(您如果(guo)有多個(ge)域名添加(jia)在這里)
DirectoryIndex index.html index.php index.htm 設(she)置默認首頁(ye)
DocumentRoot /www/web/www_test_com/public_html 和(he) Directory "/www/web/www_test_com/public_html " 都是指定網站的目(mu)錄,需要一(yi)致。
按“esc”退(tui)出(chu)編輯(ji)模(mo)式,輸入“:wq”保存退(tui)出(chu)。
4.輸入命令:/alidata/server/httpd/bin/apachectl restart 重啟apache測試。
5.測試(shi)網站。請在瀏(liu)覽器中輸入域名,測試(shi)設(she)置。
會員評論