How to deploy a PHP website on IIS

醉折花枝作酒筹
Release: 2023-03-09 19:18:01
forward
2712 people have browsed it

This article will introduce to you how to deploy a PHP website on IIS. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

How to deploy a PHP website on IIS

Before deploying the website, check whether CGI has been installed on the system

1. Start the iis server and open the IIS server

Open the IIS server. Click the website, right-click "Add Website"

2. Create a website

After clicking "Add Website", enter the page and fill in the relevant content of the website, such as: Website name, physical path (the folder where the website is located), click "OK" to create successfully

3. PHP settings

Click on the created website, click "Handler Mapping", click "Add Mapping Module" on the right, enter the corresponding parameters in the pop-up layer, and click Confirm

Set default document

Click "Default Document", right-click the "Add" button, add a default document, enter index.php, click "OK" to add

4. Install urlrewrite

5. Use URL rewrite

Click "URL Rewrite", Click "Import Rules" on the right, select the rule file to be imported, and click Apply

#After applying the rule, the website is located A web.config file will be generated in the root directory. I am using the .htaccess file import rules of thinkphp

File content:

<?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>
Copy after login

Recommended learning: php video tutorial

The above is the detailed content of How to deploy a PHP website on IIS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template