(系統(tǒng)CentOs6.5 64)
參考文章
使用如下命令查看系統(tǒng)是否安裝Apache
rpm -qa |grep httpd
未安裝則會(huì)什么都不提示
未安裝則按照上述教程安裝(我的是已安裝的)
安裝完成后先使用
service httpd start
來啟動(dòng)一下Apache httpd服務(wù)器,啟動(dòng)的時(shí)候會(huì)發(fā)現(xiàn)出現(xiàn)提示信息:
httpd:httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
這時(shí)候你需要去/etc/httpd/conf/httpd.conf 中修改一下配置,將
ServerName www.example.com:80
更改為
ServerName localhost:80
重啟Apache
service httpd restart
然后就可以測(cè)試了
可以在本機(jī)的瀏覽器中輸入
http://ip地址(或者域名):80
如果打不開則需要去iptables文件修改配置添加如下內(nèi)容
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
將端口號(hào)加入到防火墻(如果防火墻關(guān)閉則可不加)
關(guān)于Apache的一下命令
service httpd start
service httpd stop
service httpd restart
service httpd status
pstree | grep httpd //驗(yàn)證服務(wù)是否啟動(dòng),比較少用
將網(wǎng)站放到指定的文件夾然后通過瀏覽器訪問
到/etc/httpd/conf/httpd.conf修改下面兩行參數(shù)
DocumentRoot "/var/www/html" //改為自己想要放的地方
<Directory "/var/www/html"> 同上
若在該目錄下放一個(gè)html文件,在瀏覽器中輸入
http://ip地址(或者域名):80/文件名
就可以看到了,可以使用ftp將網(wǎng)站文件放到指定目錄關(guān)于FTP安裝與配置
修改打開域名就可以看到的網(wǎng)頁
在網(wǎng)站的根目錄放置一個(gè)index.html文件,在這個(gè)文件里可以加個(gè)自動(dòng)跳轉(zhuǎn)鏈接,這樣也算是打開固定的網(wǎng)頁了
這里我覺得可以理解為Apache會(huì)自動(dòng)去搜索網(wǎng)站根目錄下的index.html文件,如果沒有則會(huì)打開Apache的歡迎頁