Fedora Apache設定


成功!!

若未安裝Apache,可以先執行以下指令:
yum list httpd

若要啟動Apache:
/sbin/service httpd start
若要停止Apache:
/sbin/service httpd stop

在Windows底下要更改php的一些相關設定,是在php.ini底下作設定。
在Linux底下則是在:/etc/httpd/conf.d/目錄下找相關的檔案去作設定。

一開始使用必須更換首頁。
STEP 1:修改設定檔
/etc/httpd/conf/httpd.conf 這裡面先將
DirectoryIndex index.html index.html.var  修改成
DirectoryIndex index.htm index.html index.html.var

STEP 2:防火牆的設定
/etc/sysconfig/iptables在這裡面必須家一行指令:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -p tcp --dport 80 -j ACCEPT  <--加入這一行
-A INPUT -j REJECT --reject-with icmp-host-prohibited
 儲存後
重開防火牆
啟動 iptables 服務
service iptables [start | restart | status]
之後要執行的檔案必須放在: /var/www/html下,例如:index.html or db_conn.php etc.
那一開始的時候,這個根目錄底下是沒有東西的,所以我們在瀏覽器的網址列上打:localhost,會有個網頁跳出來,其實那是錯誤的。
當apache底下沒有檔案時,他會判斷成錯誤訊息而跳出那個網頁。
接著,在/etc/httpd/conf.d/welcome.conf,其中有四行前面加 "#" 號就可以了。
#<LocationMatch "^/+$">
    Options -Indexex
#     ErrorDocument 403 /error/noindex.html
#</LocationMatch>
然後重新啟動apache:
/sbin/ service httpd restart
就完成了。

留言

熱門文章