本文章介紹的目的就是實(shí)現(xiàn)在 openSUSE 13.1 系統(tǒng)下,配置 Apache 服務(wù)器綁定 m.survivalescaperooms.com二級(jí)域名,具體配置步驟如下.
DNS 綁定 A 記錄#
首先在 DNS 上創(chuàng)建 A 記錄,將域名綁定到相應(yīng) IP 上.
創(chuàng)建站點(diǎn)目錄#
在服務(wù)器上,添加 /srv/www/vhosts/m.survivalescaperooms.com 目錄,并在該目錄下創(chuàng)建一個(gè) index.html 文件 – 用于測(cè)試.
配置 Apache#
創(chuàng)建虛擬主機(jī)配置文件#,代碼如下:
- $ cd /etc/apache2/vhosts.d
- $ sudo cp vhost.template m.survivalescaperooms.com.conf
修改 m.survivalescaperooms.com.conf 文件內(nèi)容如下:
- <VirtualHost *:80>
- ServerName m.survivalescaperooms.com
- ServerAdmin chenxsan@gmail.com
- DocumentRoot /srv/www/vhosts/m.survivalescaperooms.com
- ErrorLog /var/log/apache2/m.survivalescaperooms.com-error_log
- CustomLog /var/log/apache2/m.survivalescaperooms.com-access_log combined
- # don't loose time with IP address lookups
- HostnameLookups Off
- # needed for named virtual hosts
- UseCanonicalName Off
- # configures the footer on server-generated documents
- ServerSignature On
- #
- # This should be changed to whatever you set DocumentRoot to.
- #
- <Directory "/srv/www/vhosts/m.survivalescaperooms.com">
- AllowOverride All
- Options FollowSymLinks
- Order allow,deny
- Allow from all
- </Directory>
- </VirtualHost>
之后重啟 Apache:
$ sudo rcapache2 restart
訪問 m.survivalescaperooms.com 網(wǎng)址,已經(jīng)可以看到 index.html 文件的內(nèi)容了,如果我們之前未添加 index.html 文件,訪問的話,則會(huì)出現(xiàn)如下錯(cuò)誤信息:
- Access forbidden!
- You don’t have permission to access the requested directory. There is either no index document or the directory is read-protected.
- If you think this is a server error, please contact the webmaster.
- Error 403
- m.survivalescaperooms.com
新聞熱點(diǎn)
疑難解答
圖片精選