一、使用rpm包安装apache服务器
# yum install httpd*
安装目录
1、可执行文件安装目录
/usr/bin
/usr/sbin
2、手册页文档
/usr/share/doc
3、启动脚本安装目录及文件
/etc/init.d/httpd
4、配置文件路径
/etc/httpd/conf
主配置文件:/etc/httpd/conf/httpd.conf
5、网站页面目录
/var/www/html
------------------------------------------------------------
apache服务器的简单配置
1、配置web服务器的名称
ServerName www.tree.com:80
2、联系人地址(web服务器发生问题的时候自动发送邮件给指定的联系人)
ServerAdmin root@tree.com
3、设置web站点根目录
DocumentRoot "/myweb/root"
4、默认的主页文件名
DirectoryIndex index.php
5、启动apache服务器
# service httpd start
---------------------------------------------------------------
apache解析php动态页面
# yum install php*
# cd /etc/httpd/conf.d
# vim php.conf
LoadModule php5_module modules/libphp5.so \\载入php模块
AddType text/html .php \\添加apache能够识别的文件类型
DirectoryIndex index.php \\添加默认的主页文件
# service httpd restart
----------------------------------------------------------------
编译安装apache+php
1、安装apache
# ./configure --prefix=/usr/local/httpd --enable-file-cache --enable-cache --enable-disk-cache --enable-mem-cache --enable-ssl --enable-static-ab --enable-http --enable-info --enable-cgi --enable-cgid --enable-vhost-alias --enable-rewrite --enable-so --with-mpm=prefork
# make
# make install
2、安装php
# ./configure --prefix=/usr/local/php --enable-calendar --enable-bcmath --with-config-file-path=/usr/local/php --enable-mod-charset --with-apxs2=/usr/local/httpd/bin/apxs
# make
# make install
# cp php.ini-production /usr/local/php/php.ini \\从源码包复制php配置文件
3、配置apache
# cd /usr/local/httpd/conf
# vim httpd.conf
LoadModule php5_module modules/libphp5.so \\加载php模块
AddType application/x-httpd-php .php \\添加php文件支持
AddType application/x-httpd-php-source .phps
# /usr/local/httpd/bin/httpd -t \\检查配置文件语法
# cd /usr/local/httpd/bin
# ./apachectl start
转载于:https://blog.51cto.com/8448262/1394985