系統centos5.5
按照鳥哥上面說的直接:yum install httpd php mysql; 省時省力。這樣的配置基本上算是搭建一個lamp。
問題一:然而無法啓動apache,在/var/log/httpd/error_log的日記中看到缺少:/etc/httpd/conf/mime.types這個文件。
費了半個多小時的時間,終於又碰到這個問題的用戶了。直接在給目錄下新建一個 mime.types 空白文件就行了(新手不容易啊)
兄弟複製一段看的懂的。詳細內容摘自;https://www.ibm.com/developerworks/cn/xml/x-tipapachexhtml/
還有介紹 mime types的文章:http://www.cnblogs.com/jsean/articles/1610265.html
Apache 配置指令
根據默認,Apache 通過檢查文件的擴展名來決定與每個文件一起發送的媒體類型。擴展名類型映射存儲於 httpd/conf 目錄(通常是類似 /usr/httpd/conf 或 /etc/httpd/conf 的目錄)下的 mime.types 文件中。比如,清單 2 顯示了 Apache 2.0 的 mime.types 文件的部分內容。
清單 2. Apache 的 mime.types
# This file controls what Internet media types are sent to the client for # given file extension(s). Sending the correct media type to the client # is important so they know how to handle the content of the file. # Extra types can either be added here or by using an AddType directive # in your config files. For more information about Internet media types, # please read RFC 2045, 2046, 2047, 2048, and 2077. The Internet media type # registry is at <http://www.iana.org/assignments/media-types/>. # MIME type Extensions application/atom+xml atom application/mathematica application/mathml+xml mathml application/msword doc application/octet-stream bin dms lha lzh exe class so dll dmg application/postscript ai eps ps application/rdf+xml rdf application/reginfo+xml application/xhtml+xml xhtml xht application/xslt+xml xslt application/xml xml xsl application/xml-dtd dtd application/xml-external-parsed-entity application/zip zip audio/mpeg mpga mp2 mp3 image/jpeg jpeg jpg jpe image/naplps image/png png image/svg+xml svg image/tiff tiff tif text/html html htm text/plain asc txt text/sgml sgml sgm text/xml text/xml-external-parsed-entity video/mpeg mpeg mpg mpe
問題二:開放端口
先臨時關閉防火牆,然後配置文件,再重啓防火牆。
摘自:http://my.oschina.net/u/217959/blog/38051
即時生效,重啓後失效:
開啓:service iptables start
關閉:service iptables stop
需要說明的是對於Linux下的其它服務都可以用以上命令執行開啓和關閉操作。
在開啓了防火牆時,做如下設置,開啓相關端口,
修改/etc/sysconfig/iptables 文件,添加以下內容:
-A RH-Firewall-1-INPUT -m state ——state NEW -m tcp -p tcp ——dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state ——state NEW -m tcp -p tcp ——dport 22 -j ACCEPT