首页 > 代码库 > Apache本地环境部署

Apache本地环境部署

1.更改host文件

 更改host文件,http请求相应域名,指向本地服务器

#本地环境部署
127.0.0.1	account.dev.com
127.0.0.1	user.dev.com

 

2.配置httpd-vhosts.conf

 在本地服务器内,寻找指定文件目录

<VirtualHost  *:80>
   ServerName	localhost
   documentRoot  "D:/ruanjian/phpstudy/WWW"
</VirtualHost>
#用户中心 <VirtualHost *:80> ServerName user.dev.com documentRoot "D:\ruanjian\phpstudy\WWW\chinaxueqian\xq_user\web" <Directory "D:\ruanjian\phpstudy\WWW\chinaxueqian\xq_user\web"> AllowOverride All Order Deny,Allow Deny from all Allow from all </Directory> </VirtualHost>

 

3.更改httpd.conf

 去掉下面这一行前面的#

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

 

4.更改.htaccess

RewriteEngine on
RewriteCond $1 !^(index\.php|ajax|images|css|scripts|assets|html|robots\.txt)
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ /index.php/$1 [L]

 

Apache本地环境部署