阿里云Lamp服务器配置Apache

一、在lamp指定位置存放下载好的yii2框架(不用框架跳过此步)

假设指定将解压好的yii文件夹重命名为项目名称(fightfight.com),放到如图所示的位置。

要注意assets文件夹的读写权限打开。

阿里云Lamp服务器配置Apache

二、按照镜像使用文档先给服务器配置一个虚拟主机阿里云Lamp服务器配置Apache

注意网站根目录选项,要直接定位到index.php的上层文件夹(如yii2框架,定位到web文件夹)

三、配置apache的httpd.conf文件

1.LoadModule vhost_alias_module modules/mod_vhost_alias.so

     去掉#

2.<Directory />

   <Directory />
       AllowOverride none
       Require all granted
       allow from all
   </Directory>


3.指定项目主页目录

DocumentRoot "/data/wwwroot/fightfight.com/web"
<Directory "/data/wwwroot/fightfight.com/web">

4.引入虚拟主机配置文件

Include conf/vhost/fightfight.com.conf

该文件在我们利用阿里云的lamp服务器创建虚拟主机时会自动生成。

三、配置fightfight.com.conf文件

DocumentRoot "/data/wwwroot/fightfight.com/web"

<Directory "/data/wwwroot/fightfight.com/web">

确定指向index.php的上级文件夹

四、重启apache服务器

五、输入服务器外网ip即可访问index.php