标签:ati yml tar 文件 httpd bsp etc list lib
1.安装apr
tar -zxvf apr-1.6.3.tar.gz cd apr-1.6.3 ./configure --prefix=/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=/usr/local/apr-util --with-apr=/usr/local/apr make make install
3.安装pcre
tar -zxvf pcre-8.39.tar.gz cd pcre-8.39 ./configure --prefix=/usr/local/pcrel make make install
4.安装apache
tar -zxvf httpd-2.4.34.tar.gz cd httpd-2.4.34 ./configure --prefix=/usr/local/apache --enable-ssl --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/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
标签:ati yml tar 文件 httpd bsp etc list lib
原文地址:https://www.cnblogs.com/ddf128/p/12123869.html