当前位置:首页 > Web开发 > 正文

重新再运行 ./configure 就可以了 2. 安装 Apr-util tar -zxvf apr-util- 1.

2024-03-31 Web开发

tar -zxvf apr-1.6.3.tar.gz cd apr-1.6.3 ./configure --prefix=http://www.mamicode.com/usr/local/apr make make install 

注意:  cannot remove ‘libtoolT‘: No such file or directory

直接打开 configure,把 $RM $cfgfile” 那行删除去,从头再运行 ./configure 就可以了

2.安置 Apr-util

tar -zxvf apr-util-1.6.1.tar.gz cd apr-util-1.6.1 ./configure --prefix=http://www.mamicode.com/usr/local/apr-util --with-apr=http://www.mamicode.com/usr/local/apr make make install

3.安置pcre

tar -zxvf pcre-8.39.tar.gz cd pcre-8.39 ./configure --prefix=http://www.mamicode.com/usr/local/pcrel make make install

4.安置apache

tar -zxvf httpd-2.4.34.tar.gz cd httpd-2.4.34 ./configure --prefix=http://www.mamicode.com/usr/local/apache --enable-ssl --enable-rewrite --with-apr=http://www.mamicode.com/usr/local/apr --with-apr-util=http://www.mamicode.com/usr/local/apr-util make make install

5.配置ServerName

     进入apache 配置文件

ServerName  localhost:80

6.改削家目录

进入httpd.conf配置文件

DocumentRoot "/home/www"

<Directory "/home/www">

7.开机启动

         将本身安置目录下的apachect1复制到该目录下并改为httpd

cp /usr/local/apache/bin/apachect1 /etc/init.d/httpd

     注:复制时注意安置目录

          编纂 vi /etc/init.d/httpd #!/bin/sh 下添加这两句

#chkconfig:345 85 15

#description:Start and stop the Apache HTTP Server

         添加启动:        chkconfig --add httpd

启动:                 chkconfig httpd on

        检察是否告成:  chkconfig --list httpd   

8.启动与封锁常用操纵 

启动:    /usr/local/apache/bin/apachectl  start

重启:    /usr/local/apache/bin/apachectl  restart

遏制:    /usr/local/apache/bin/apachectl  stop

不中断:    /usr/local/apache/bin/apachectl  graceful

9.Apache解析php

首先http.conf中配置

LoadModule php7_module modules/libphp7.so   开启注释

其次在配置文件httpd.conf<IfModule mime_module></IfModule>块里增加一行

AddType application/x-httpd-php .php

ServerName 127.0.0.1:80

然后搜索<IfModule dir_module>下面这一块添加上index.php

<IfModule dir_module>

DirectoryIndex index.html index.php

</IfModule>

重启apache

10.Apache 禁止目录浏览

打开apache配置文件httpd.conf

找到Options Indexes

<Directory />

Options Indexes

AllowOverride None

Order allow,deny

Allow from all

</Directory>

改削

Options Indexes 改削为Options None

Options Indexes FollowSymLinks,,改削为Options None

centos7 php开发环境安置-Apache

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/32557.html