tp项目部署在西部数码

1.将public下的index.php移到wwwroot根目录下,修改路径层级关系,将…/替换为/

<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2019 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

// [ 应用入口文件 ]
namespace think;

require __DIR__ . '/vendor/autoload.php';

// WEB入口文件位置
define('PUBLIC_PATH','');

define('EXTEND_PATH', __DIR__ .'/extend/');
define('VENDOR_PATH', __DIR__ .'/vendor/');

// 执行HTTP应用并响应
$http = (new App())->http;

$response = $http->run();

$response->send();

$http->end($response);

2.在wwwroot下创建一个iis的伪静态配置文件,名称是web_config

<?xml version="1.0" encoding="UTF-8"?>
   <configuration>
     <system.webServer>
       <rewrite>
         <rules>
            <rule name="Imported Rule 1" stopProcessing="true">
              <match url=".*\.(?:gif|jpg|png|css|js|txt|jpeg|swf|flv)" />
             <action type="Rewrite" url="/public/{R:0}" />
           </rule>
            <rule name="Imported Rule 2">
             <match url="/httpd(?:\.ini|\.parse\.errors)" />
              <action type="CustomResponse" url="/" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
            </rule>
           <rule name="Imported Rule 3" stopProcessing="true">
              <match url="^(?!/index.php)(?!/admin.php)(.*)$" ignoreCase="false" />
              <conditions logicalGrouping="MatchAll">
              <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
              </conditions>
             <action type="Rewrite" url="/index.php/{R:1}" />
           </rule>
        </rules>
      </rewrite>
   </system.webServer>
</configuration>

3.在域名管理下,域名解析:@ CNAME 虚拟主机上传的地址
4. 在主机管理中域名绑定
5. 在主机管理中设置php版本

注意: 设置首页设置为index.php
虚拟目录不用添加public

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值