---
title: "centos 安装 apache httpd 支持php 和 rewrite"
author: "gutou9"
date: "2018-06-19T10:33:55Z"
tags: []
categories: ["开源软件"]
slug: "centos-apache-httpd-php-rewrite"
draft: false
lastmod: "2018-06-19T10:33:55Z"
id: 2425145
url: "https://gutou9.iteye.com/blog/2425145"
---

安装

yum install httpd httpd-devel mod\_ssl

 

查看版本

httpd -v

 

启动

service httpd start

 

更改 /etc/httd/conf 中的 httpd.config

 

1 更改默认路径 

DocumentRoot "/var/www/html" 为 DocumentRoot "/usr/local/zblog"

2 添加模块

 

#支持php

LoadModule php5\_module modules/libphp5.so 

 

 #支持重定向 伪静态

LoadModule rewrite\_module modules/mod\_rewrite.so 

AllowOverride All 

 

支持 php扩展名

 

    DirectoryIndex index.html index.php 

 

    AddType application/x-httpd-php-source .phps

    AddType application/x-httpd-php .php

 

 

service httpd restart