iis method of deploying a php website: first start the iis server and open the IIS server; then enter the page to fill in the website-related content; then handle the program mapping; and finally set the default document to "index.php".
Recommended: "PHP Video Tutorial"
1. Start the iis server and open the IIS server
Open the IIS server, click on the website, right-click "Add Website"
2. Create a website
After clicking "Add Website", Enter the page and fill in the website-related content, 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 the default document
Click "Default Document", right-click the "Add" button, add the 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 , a web.config file will be generated in the root directory of the website. I use the import rules of thinkphp's .htaccess file
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>
The above is the detailed content of How to deploy php website in iis. For more information, please follow other related articles on the PHP Chinese website!