系统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