search
Homephp教程php手册[1]PHP开发环境搭配之Apache2.2配置

[1]PHP开发环境搭配之Apache2.2配置

Jun 06, 2016 pm 08:02 PM
phpstepdevelopmatchenvironmentConfiguration

Step1. 软件准备:httpd-2.2.25-win32-x86-no_ssl.msi 下载地址:http://download.csdn.net/detail/uudmail0818/6983753 Step2. 在D盘建立AMP文件夹,用于安装LAMP需要的软件 双击httpd-2.2.25-win32-x86-no_ssl.msi开始安装 这里选择自定义的custom 更改安

Step1.

软件准备:httpd-2.2.25-win32-x86-no_ssl.msi

下载地址:http://download.csdn.net/detail/uudmail0818/6983753


Step2.

在D盘建立AMP文件夹,用于安装LAMP需要的软件

双击httpd-2.2.25-win32-x86-no_ssl.msi开始安装

[1]PHP开发环境搭配之Apache2.2配置

这里选择自定义的custom

[1]PHP开发环境搭配之Apache2.2配置

更改安装路径

[1]PHP开发环境搭配之Apache2.2配置

一路到finish


Step3.

启动Apache 

[1]PHP开发环境搭配之Apache2.2配置

测试下

在浏览器中输入localhost,回车显示it works。说明配置成功


配置虚拟目录步骤

主要配置

找到DocumentRoot和Directory

把后面的目录改成你想储存网站源码的位置

如我的是存在D盘的www目录下的。

DocumentRoot "D:/www"

另外改个地方,在DocumentRoot和Directory之间的deny from all删掉

加上Allow from all


    Options FollowSymLinks
    AllowOverride None
    Order deny,allow    
    Allow from all


把#Include conf/extra/httpd-vhosts.conf 前面的#去掉

表示开启虚拟目录扩展


可选项配置

在httpd.conf主配置文件,

DirectoryIndex 设置,代表默认主页

可以设置index.html ,index.php default.html等等,

也可以设置多个默认主页,且优先级按顺序从前到后降低.


在extra文件夹下找到httpd-vhosts文件,打开编辑

复制一份以下代码


    ServerAdmin webmaster@dummy-host2.localhost
    DocumentRoot "D:/Amp/apache2.2/docs/dummy-host2.localhost"
    ServerName dummy-host2.localhost
    ErrorLog "logs/dummy-host2.localhost-error.log"
    CustomLog "logs/dummy-host2.localhost-access.log" common

修改成以下格式,主要是配置DocumentRoot 和ServerName,其他的可以暂时不了解。


 
    DocumentRoot "D:\Amp\apache2.2\htdocs"
    ServerName localhost  


这个设置的域名为www.myphp.com。可以本地直接访问
 
    DocumentRoot "D:/www/myphp"
    ServerName www.myphp.com   


这个设置的域名为www.phpweb.com。可以本地直接访问
 
    DocumentRoot "D:/www/phpweb"
    ServerName www.phpweb.com   

最后在系统的hosts文件中加入

127.0.0.1 www.myphp.com
127.0.0.1 www.phpweb.com

即可成功。




Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.