IIS 中安装Laravel

8 篇文章 0 订阅
2 篇文章 0 订阅

如不知道怎么安装IIS,请看https://blog.csdn.net/YanWenGuang123/article/details/124250544,里面有安装IIS方法。
IIS下载链接:https://pan.baidu.com/s/1qEJe3ESXbf-eoqGnjyFFuQ 提取码:67mp

一、安装laravel

PHP >= 7.1
Laravel 5.5.0 ~ 8.*

开始安装
如果安装过程中出现 composer 下载过慢或安装失败的情况,请运行命令 composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ 把 composer 镜像更换为阿里云镜像。

composer create-project --prefer-dist laravel/laravel 项目名称

在IIS管理器中添加并配置站点,配置成功后 public目录下会生成一个web.config文件,该文件相当于Apache中的 .htaccess文件
在这里插入图片描述
web.config 中内容如下:

<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Imported Rule 1" stopProcessing="true">
          <match url="^(.*)/$" ignoreCase="false" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
          </conditions>
          <action type="Redirect" redirectType="Permanent" url="/{R:1}" />
        </rule>
        <rule name="Imported Rule 2" stopProcessing="true">
          <match url="^" ignoreCase="false" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
          </conditions>
          <action type="Rewrite" url="index.php" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

PS:我这原先环境没有不到php7.1,在php官网中下载php7.4的包,配置php.ini
在当前网站下->处理程序映射,添加php7.4映射
在这里插入图片描述
添加成功后,在web.config文件中 rewrite下面会自动添加

<handlers>
	<add name="php7.4" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="D:phpStudy4IISphp-7.4.29-ntsphp-cgi.exe" resourceType="File" />
</handlers>

在访问url过程中,如报500错误,检查IIS中是否有url重写模块。
url重写模块下载链接:https://pan.baidu.com/s/1ZSgG55T4RLyqbJtsVNJizg 提取码:y087
安装后即可访问。

PS:在服务器建站是,少VC运行库,下载安装即可。
链接:http://soft.360.cn/static/baoku/info_7_0/softinfo_104698064.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

是宽宽呀

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值