1. 登錄您的Linux雲主機,進入WEB伺服器配置文件夾;
運行命令:cd /aliyun/webserver/apache2.2.15/conf
2、 備份WEB伺服器配置文件;
運行命令:cp httpd.conf httpd.conf.bak
3、 修改WEB伺服器配置文件;
運行命令:vi + httpd.conf
4、 添加網站配置信息;
1) 按字母i鍵,進入編輯模式;
2) 在配置文件末尾,添加
ServerAdmin admin@domain(您的郵箱)
DocumentRoot /alidata/www/wwwroot/phpwind (網站存放路徑)
ServerName test.com (網站域名)
ServerAlias www.test.com(網站別名)
ErrorDocument 404 /404.php
DirectoryIndex index.html index.php index.htm
(網站存放路徑)
Options +Includes
AllowOverride None
Order allow,deny
Allow from all
3) 保存修改。按ESC鍵,輸入」:wq」後回車;
4) 使配置生效。運行命令:../bin/apachectl graceful
5) 測試網站。請在瀏覽器中輸入域名,測試設置。
推薦使用小鳥雲伺服器:
小鳥雲專注為個人開發者用戶、中小型、大型企業用戶提供一站式核心網路雲端部署服務,促使用戶雲端部署化簡為零,輕鬆快捷運用雲計算。小鳥雲伺服器全線採用高端Intel Haswell CPU,能夠針對企業的不同需求提供多種功能,內存採用最新DDR4內存條,,大大提升數據的訪問速度;磁碟採用高速Sas3 SSD高頻固態硬碟,可滿足Sas介面系統的所有需求,大幅提高用戶資料庫性能,提高大並發場景下的響應速度,保障高負載下的完美用戶體驗。
2、linux伺服器如何綁定域名?
使用一鍵安裝包配置的apache環境,添加網站配置方法如下:
1.命令:cd /alidata/server/httpd/conf/vhosts/
進入網站的配置文件目錄
2.命令:vi aa.conf
創建一個新的配置文件
3.按鍵盤上的字母 「i」 ,開始編輯文件,將下面的內容復制過去。
Order allow,deny
Deny from all
DocumentRoot /alidata/www/test
ServerName www.test.com
ServerAlias test.com
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/test-error.log"
CustomLog "/alidata/log/httpd/test.log" common
對應自己的
ServerName www.test.com 綁定的網站域名
ServerAlias test.com 綁定的網站別名(您如果有多個域名添加在這里)沒有的話,這個可以刪除。
DirectoryIndex index.html index.php index.htm 設置默認首頁
DocumentRoot /alidata/www/test 和 Directory "/alidata/www/test" 和 DirectoryMatch "/alidata/www/test/都是指定網站的目錄,需要一致。
ErrorLog "/alidata/log/httpd/test-error.log" 和 CustomLog "/alidata/log/httpd/test.log" 對應的日誌名字也需要自己修改一下,可以區分網站的日誌信息。
4.輸入命令:/alidata/server/httpd/bin/apachectl restart 重啟apache測試。
3、linux中什麼是域名伺服器配置
你得需求不是很看得懂哦,我就只把區域配置文件截圖發給你了,詳情可以參照博客:
4、Linux9.0DNS伺服器的配置文件中,如何設置域名tea.com的正向區域?
哦,這個玩意有個演示文件的,修改了就可以了。因為我也是改出來的。
5、linux怎麼配置dns緩存伺服器和主從伺服器
BIND安裝
軟體下載地址:http://www.isc.org/software/bind,目前最新版本是BIND 9.8.1-P1。
安裝依賴:
yum -y install gcc openssl-devel
開始安裝bind.
wget ftp://ftp.isc.org/isc/bind9/9.8.1-P1/bind-9.8.1-P1.tar.gz
tar xzf bind-9.8.1-P1.tar.gz
cd bind-9.8.1-P1
./configure --prefix=/usr/local/bind
make && make install
執行完成後,bind已經安裝到了/usr/local/bind目錄。
配置主dns伺服器
配置bind主要是兩種文件,一是主配置文件named.conf,二是區域文件zone(包括正解析,反解析)。
在下面的配置中,我們的主dns伺服器是ns1.qbtop.com 23.19.81.191,從dns伺服器是ns2.qbtop.com 23.19.81.194(這兩個dns都已經在godaddy注冊好了)。
下面操作僅在主dns伺服器23.19.81.191執行。
主配置文件named.conf
首先執行rndc-confgen -a生成/etc/rndc.key密鑰文件。
/usr/local/bind/sbin/rndc-confgen -a
vi /usr/local/bind/etc/named.conf
寫入如下內容:
include "/usr/local/bind/etc/rndc.key";
controls { inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys { "rndckey"; }; };
logging {
channel default_syslog { syslog local2; severity notice; };
channel audit_log { file "/var/log/bind.log"; severity notice; print-time yes; };
category default { default_syslog; };
category general { default_syslog; };
category security { audit_log; default_syslog; };
category config { default_syslog; };
category resolver { audit_log; };
category xfer-in { audit_log; };
category xfer-out { audit_log; };
category notify { audit_log; };
category client { audit_log; };
category network { audit_log; };
category update { audit_log; };
category queries { audit_log; };
category lame-servers { audit_log; };
};
options {
directory "/usr/local/bind/etc";
pid-file "/usr/local/bind/var/run/bind.pid";
transfer-format many-answers;
interface-interval 0;
allow-query { any; };
};
zone "qbtop.com" {
type master;
file "qbtop.com.zone";
allow-transfer { 23.19.81.194; };
};
zone "81.19.23.in-addr.arpa" {
type master;
file "81.19.23.in-addr.arpa";
allow-transfer { 23.19.81.194; };
};
named.conf文件說明:
上面的named.conf文件包括三部分:key,controls,logging,options,zone。
logging:設置日誌伺服器和日誌信息的發送地。
options:控制伺服器的全局配置選項和為其它語句設置默認值
zone:定義一個域,比如正解析域和反解析域。
logging是定義日誌的,不需要深究,主要是options和zone。
在options中:
directory "/usr/local/bind/etc":定義bind的工作目錄為/usr/local/bind/etc,配置文件中所有使用的相對路徑,指的都是在這里配置的目錄下。
pid-file "/usr/local/bind/var/run/bind.pid":把bind程序運行的pid寫入文件bind.pid。
transfer-format many-answers:使用更加有效的域傳輸格式many-answers。
allow-query { any; }:允許所有用戶查詢dns。
在zone中:
這里定義了兩個zone,一個是正解析zone qbtop.com,一個是反解析zone 81.19.23.in-addr.arpa。
他們的參數基本相同:
type master:定義dns伺服器為主dns。
file "qbtop.com.zone":定義此zone的文件名。
allow-transfer { 23.19.81.194; }:允許向從dns 23.19.81.194傳輸dns數據。
唯一不同的是zone名稱的定義,正解析zone名稱的定義是受權的域名,可以是頂級域名,也可以是二級域名,或多級。反解析zone名稱定義規定前部分ip倒著寫。如ip 192.168.1.2,名稱定義為1.168.192.in-addr.arpa。
正解析qbtop.com.zone
vi /usr/local/bind/etc/qbtop.com.zone
寫入如下內容:
$TTL 3600
@ IN SOA ns1.qbtop.com. hostmaster.qbtop.com. (
2012022301 ; Serial
3600 ; Refresh
900 ; Retry
3600000 ; Expire
3600 ) ; Minimum
@ IN NS ns1.qbtop.com.
@ IN NS ns2.qbtop.com.
ns1 IN A 23.19.81.191
ns2 IN A 23.19.81.194
aaa IN A 23.19.81.191
bbb IN A 23.19.81.191
文件說明:
$TTL 3600:指示為每個沒有特殊TTL設置的RR給出了一個默認的TTL。
@ IN SOA ns1.qbtop.com. hostmaster.qbtop.com. (
2012022301 ; Serial
3600 ; Refresh
900 ; Retry
3600000 ; Expire
3600 ) ; Minimum
定義SOA記錄,包括Zone的名字,一個技術聯系人和各種不同的超時值。
@ IN NS ns1.qbtop.com.
@ IN NS ns2.qbtop.com.
設置兩個ns記錄ns1.qbtop.com和ns2.qbtop.com。
ns1 IN A 23.19.81.191
ns2 IN A 23.19.81.194
aaa IN A 23.19.81.191
bbb IN A 23.19.81.191
設置主機為ns1,ns2,aaa和bbb的A記錄。
反解析文件81.19.23.in-addr.arpa
反解析zone可以不設置。
vi /usr/local/bind/etc/81.19.23.in-addr.arpa
寫入如下內容:
$TTL 3600
@ IN SOA ns1.qbtop.com. hostmaster.qbtop.com. (
2012022301 ; Serial
3600 ; Refresh
900 ; Retry
3600000 ; Expire
3600 ) ; Minimum
@ IN NS ns1.qbtop.com.
@ IN NS ns2.qbtop.com.
191 IN PTR ns1.qbtop.com.
194 IN PTR ns2.qbtop.com.
說明:
上部分是定義SOA記錄,下部分是設置IP反解析。
如設置IP 23.19.81.191反解析成ns1.qbtop.com,23.19.81.194反解析成ns2.qbtop.com。
配置從DNS伺服器
下面我們來配置從DNS伺服器。配置從DNS伺服器只需要配置主配置文件named.conf,zone文件不需配置,因為這是從主DNS伺服器獲取的。
首先建立目錄slaves用來存放從主dns獲取的zone文件。
mkdir /usr/local/bind/etc/slaves
寫入如下內容:
logging {
channel default_syslog { syslog local2; severity notice; };
channel audit_log { file "/var/log/bind.log"; severity notice; print-time yes; };
category default { default_syslog; };
category general { default_syslog; };
category security { audit_log; default_syslog; };
category config { default_syslog; };
category resolver { audit_log; };
category xfer-in { audit_log; };
category xfer-out { audit_log; };
category notify { audit_log; };
category client { audit_log; };
category network { audit_log; };
category update { audit_log; };
category queries { audit_log; };
category lame-servers { audit_log; };
};
options {
directory "/usr/local/bind/etc";
pid-file "/usr/local/bind/var/run/bind.pid";
transfer-format many-answers;
interface-interval 0;
allow-query { any; };
};
zone "qbtop.com" {
type slave;
file "slaves/qbtop.com.zone";
masters { 23.19.81.191; };
};
zone "81.19.23.in-addr.arpa" {
type slave;
file "slaves/81.19.23.in-addr.arpa";
masters { 23.19.81.191; };
};
文件說明:
從dns跟主dns主要的區別是zone的定義,type slave定義此dns伺服器為從dns,masters { 23.19.81.191; }定義主dns的IP。
啟動BIND
1、在啟動BIND之前,我們需要執行/usr/local/bind/sbin/named-checkconf檢查named.conf配置文
件,和執行/usr/local/bind/sbin/named-checkzone zone名稱
zone文件名,如/usr/local/bind/sbin/named-checkzone qbtop.com
/usr/local/bind/etc/qbtop.com.zone。
然後調試模式啟動bind,/usr/local/bind/sbin/named -g,g參數的意思是前台執行bind,這會輸出啟動的信息,發現沒有嚴重的錯誤後,再把g參數刪除重新以/usr/local/bind/sbin/named方式後台啟動bind。
2、設置開機啟動,在/etc/rc.d/rc.local中加入/usr/local/bind/sbin/named。
手動添加記錄
1、直接添加刪除或修改zone文件里的記錄
2、執行rndc reload zone名稱重載,如rndc reload qbtop.com
6、linux伺服器如何設置二級域名
首先域名的控制面板那裡要添加一個二級域名並解析到你的linux伺服器上
然後在linux伺服器中的web伺服器上,比如nginx,apache上增加以此域名為名稱的虛擬主機
7、linux伺服器 Apache伺服器如何設置二級域名綁定子目錄?
echo "NameVirtualHost *:80">>/etc/httpd/conf/httpd.conf
DocumentRoot 「/var/www/html/erji.test.com」
ServerName erji.test.com
類似這樣的配置不行?
8、Linux 伺服器如何配置網站以及綁定域名
一般使用第三方面板來配置網站環境,和部署網站。
個人建站的辦法很簡單,首先網站1核2G內存1M帶寬,40G高效雲盤。要准備以下的資料
注冊域名。最好能和網站內容有點關聯
選擇網站系統。例如wordpress,zblog,emblog等都可以。
選擇雲伺服器,例如阿里或者騰訊等
解析域名到伺服器
發布網站到雲主機以上步驟還是需要一些知識的。
至此,網站建設完成。老魏為此寫過雲伺服器手動建站等多篇教程,看完有疑問可以問,在線了就回答。