如何添加網(wǎng)站for Linux(綁定域名)
來(lái)源:程序員人生 發(fā)布時(shí)間:2014-10-18 08:00:01 閱讀次數(shù):4226次
【以下配置的路徑以阿里云提供的標(biāo)準(zhǔn)環(huán)境路徑為準(zhǔn),如果您另行安裝,請(qǐng)根據(jù)實(shí)際安裝路徑配置】。
1.cd /alidata/server/httpd/conf/vhosts/ 進(jìn)入綁定域名所在目錄,
2.vim test.conf 建立一個(gè)配置文件,test可以自己命名;
3.點(diǎn)擊字母“i”開(kāi)始編輯文件,輸入內(nèi)容:
DocumentRoot /alidata/www/phpwind
ServerName localhost
ServerAlias localhost
Options -Indexes FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
RewriteEngine On
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)/simple/([a-z0-9\_]+.html)$ $1/simple/index.php?$2
ErrorLog “/alidata/log/httpd/phpwind-error.log”
CustomLog “/alidata/log/httpd/access/phpwind.log” common
其中:
ServerName www.test.com 綁定的網(wǎng)站域名
ServerAlias test.com 綁定的網(wǎng)站別名(您如果有多個(gè)域名添加在這里)
DirectoryIndex index.html index.php index.htm 設(shè)置默認(rèn)首頁(yè)
DocumentRoot /alidata/www/test 和 Directory “/alidata/www/test” 都是指定網(wǎng)站的目錄,需要一致。
按“esc”退出編輯模式,輸入“:wq”保存退出。
4.輸入命令:/alidata/server/httpd/bin/apachectl restart 重啟apache測(cè)試。
5.測(cè)試網(wǎng)站。請(qǐng)?jiān)跒g覽器中輸入域名,測(cè)試設(shè)置。
視頻資料
生活不易,碼農(nóng)辛苦
如果您覺(jué)得本網(wǎng)站對(duì)您的學(xué)習(xí)有所幫助,可以手機(jī)掃描二維碼進(jìn)行捐贈(zèng)