linuxapache域名綁定域名
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介面系統的所有需求,大幅提高用戶資料庫性能,提高大並發場景下的響應速度,保障高負載下的完美用戶體驗。
Ⅱ 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測試。
Ⅲ Apache怎麼樣配置綁定域名
http://blog.csdn.net/mayongzhan/archive/2007/12/20/1956214.aspx
前提
俺沒有DNS服務.用的是windows.要做虛擬主機
-----------------------------------------------------------------------
首先搞定dns,這個是關鍵...apache的虛擬主機要有dns的解析才能使用
Win9x中這個文件位於windows目錄下,文件名可能是hosts.sam;Win2K及以後的操作系統中這個文件位於WINNT\system32\drivers\etc 目錄下,文件名為hosts。
打開就能看到
127.0.0.1 localhost
熟悉吧...這下知道localhost為什麼也叫主機了吧
添加一個 test.com和test.myz
這樣好象不能用book.test.myz或者news.test.myz...這個就要用dns了...
完成如下:
127.0.0.1 localhost
127.0.0.1 test.com
127.0.0.1 test.myz
-----------------------------------------------------------------------
下面就開始做虛擬主機
我的項目目錄D:/馬永占
在裡面建立兩個文件夾做測試
一個叫myz,一個叫myz2
在httpd.conf最後加上,如下....
NameVirtualHost *:80
<VirtualHost *:80>
ServerName test.com
DocumentRoot D:/馬永占/myz
</VirtualHost>
<VirtualHost *:80>
ServerName test.myz
DocumentRoot D:/馬永占/myz2
</VirtualHost>
別忘了重啟apache
然後可以試了
放個index.html在test文件夾下
訪問test.com OK
如果出現403,請查看apache中的目錄許可權設置
出現404,請查看上面寫的documentroot是否正確,再看看文件夾里是否有文件....對了,也可以把Include conf/extra/httpd-vhosts.conf前面的#去掉
然後去extra文件夾里找那個文件.在裡面寫VirtualHost
注意:寫了VirtualHost後如果遇到沒有的,就默認執行第一個VirtualHost
Ⅳ linux 雲主機已經配置了apache 如何綁定域名求命令和步驟。
綁定域名是在apache配置文件里做的,一般vhosts.cfg打開修改就可以。這是做虛擬主機的例子。
Ⅳ linux 如何綁定網站
你好
搭建好操作平台後,以下配置的路徑以標准環境路徑為准,如果您另行安裝,請根據實際安裝路徑配置。
1.cd /alidata/server/httpd/conf/vhosts/ 進入綁定域名所在目錄,
2.vim test.conf 建立一個配置文件,test可以自己命名;
3.點擊字母「i」開始編輯文件,輸入內容:
<VirtualHost *:80>
DocumentRoot /alidata/www/phpwind
ServerName localhost
ServerAlias localhost
<Directory "/alidata/www/phpwind">
Options -Indexes FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
<IfMole mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)/simple/([a-z0-9_]+.html)$ $1/simple/index.php?$2
</IfMole>
ErrorLog "/alidata/log/httpd/phpwind-error.log"
CustomLog "/alidata/log/httpd/access/phpwind.log" common
</VirtualHost>
其中:
ServerName www.test.com 綁定的網站域名
ServerAlias test.com 綁定的網站別名(您如果有多個域名添加在這里)
DirectoryIndex index.html index.php index.htm 設置默認首頁
DocumentRoot /alidata/www/test 和 Directory "/alidata/www/test" 都是指定網站的目錄,需要一致。
按「esc」退出編輯模式,輸入「:wq」保存退出。
4.輸入命令:/alidata/server/httpd/bin/apachectl restart 重啟apache測試。
5.測試網站。請在瀏覽器中輸入域名,測試設置。
Ⅵ 如何在Linux下使用Apache服務綁定域名
我apache提供web服務。
如果你要綁定域名的話,可以去域名的後台管理進行綁定。如果是在自己的電腦上的話,可以安裝dns伺服器。
Ⅶ apache下怎麼綁定域名啊詳細一點
我把我們公司Apache的配置文件粘貼給你看下。我們知道Apache的配置文件位置在/etc/httpd/conf/httpd.conf中,所有的基本配置以及虛擬網站都可以寫在這里。
NameVirtualHost*:80
<VirtualHost*:80>
DocumentRoot/home/xwqc/wwwroot
ServerNamexwqc.linux.zhaomuhost.cn
ServerAliaszhaomu.comyourdomain.com
DirectoryIndexindex.phpindex.htmindex.html
ErrorLog/home/xwqc/logfiles/error_log
CustomLog/home/xwqc/logfiles/access_logcommon
</VirtualHost>
其中ServerName是綁定的主域名,ServerAlias中的www.zhaomu.com是綁定的其他附屬域名。另外注意配置文件中要設置好埠號,並且關閉伺服器防火牆,或者在防火牆上開放80埠後才能正常訪問。
Ⅷ linux伺服器 Apache伺服器如何設置二級域名綁定子目錄
首先,解析二級域名,綁定到同一個IP。 假如二級域名是erji.test.com
進入伺服器,打開http.conf
一般情況下文檔最下面是有一段
#<VirtualHost *:80>
#ServerAdmin .....................
#DocumentRoot /www/docs/..............
#ServerName mmy-host.example.com
#.........
#...........
#</VirtualHost>
把上面一段前面的#號去掉,然後修改DocumentRoot的路徑到二級文檔的目錄,serverName也改一下,然後在中間加一行 ServerAlias erji.test.com
保存 重啟httpd