沒有親自試過,參考鏈接:https://m.php.cn/article/488265.html
- iis下能部署php網站,其操作方法是:1、啓動iis服務器,打開IIS服務器;2、創建網站;3、點擊“處理程序映射”,點擊右側的“添加映射模塊”;4、添加默認文檔,輸入“index.php”;5、使用URL重寫即可。
在IIS上部署PHP網站
部署網站前查看一下系統是否已經安裝CGI
1、啓動iis服務器,打開IIS服務器
打開IIS服務器,點擊網站,右擊“添加網站”
2、創建網站
點擊“添加網站”後,進入頁面填寫網站相關內容,如:網站名稱、物理路徑(網站所在文件夾),點擊“確定”創建成功
3、PHP設置
點擊創建好的網站,點擊“處理程序映射”,點擊右側的“添加映射模塊”,在彈出層中輸入對應的參數,點擊確認
設置默認文檔
點擊“默認文檔”,鼠標右擊“添加”按鈕,添加默認文檔,輸入index.php,點擊“確定”添加
4、安裝urlrewrite
5、使用URL重寫
點擊“URL重寫”,點擊右側的“導入規則”,選擇要導入的規則文件,點擊應用即可
應用規則後,網站所在根目錄會生成一個web.config文件,我這個用的是thinkphp的.htaccess文件導入的規則
文件內容:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="已導入的規則 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<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/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
<handlers>
<add name="php-cgi" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="D:\phpStudy\php56n\php-cgi.exe" resourceType="File" />
</handlers>
<defaultDocument>
<files>
<add value="index.php" />
</files>
</defaultDocument>
</system.webServer>
</configuration>