一,安装apache: # mkdir /vegas # cd /vegas # wget http://mirror./apache//httpd/httpd-2.2.24.tar.gz # tar zxvf httpd-2.2.24.tar.gz /vegas //以上下载解压apache # cd httpd-2.2.24 # ./configure --prefix=/usr/local/apache --enable-so # make # make install //以上安装apache # cd /usr/local/apache/conf # cp –a httpd.conf httpd.conf.bak //备份配置文件 # service httpd status //查看自带httpd服务状态 # service httpd stop //停止自带httpd服务 # /usr/local/apache/bin/apachectl -k graceful //启动httpd服务 # ps -ef | grep httpd //linux下查看apache进程 # cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/apache //拷贝apache启动脚本 # vi /etc/sysconfig/iptables //修改防火墙,打开80端口,添加到默认的22端口这条规则的下面 -A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT(允许80端口通过防火墙) # /etc/init.d/iptables restart //重启防火墙服务 测试一下,看出现了it works这几个字了不。 二,安装php: # cd vegas # wget http://www./get/php-5.4.13.tar.gz/from/cn2./mirror # tar zxvf php-5.4.13.tar.gz # cd php-5.4.13 # ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/lib --enable-track-vars --with-xml --with-MySQL # make # make install 三,配置 httpd.conf 让apache支持PHP: # vi /usr/local/apache/conf/httpd.conf 找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容 AddType application/x-httpd-php .php (.前面有空格) AddType application/x-httpd-php-source .phps (.前面有空格) # cp php.ini-development /usr/local/php5/lib/php.ini //copy php配置文件 # /usr/local/apache/bin/apachectl -k graceful //重启httpd服务 写一个php测试页info.php,放到apache/htdocs中。 <?php phpinfo(); ?>; |
|