This is my web.config on IIS10 and I am hosting wordpress site on it which I have migrated from other hosting.
For existing uploads, when I open a file in browser, it is displayed, but for new uploads, I get Internal server error 500. I think it might have to do something with web.config, but not sure. Do you think I have something missing there? Or is this a wordpress issue?
Url I test where I get 500 is like this: https://www.example.com/wp-content/uploads/2021/01/test.pdf
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^index.php$" ignoreCase="false" />
<action type="None" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="." 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" />
</rule>
<rule name="Imported Rule 1-1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTPS}" pattern="off" ignoreCase="false" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{URL}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
<handlers>
<remove name="PHP_via_FastCGI1" />
<remove name="PHP53_via_FastCGI" />
</handlers>
</system.webServer>
</configuration>
Here is the error I am getting:
From logs:
2021-01-29 13:42:17 192.168.1.41 GET /wp-content/uploads/2021/01/v2_1.jpg - 443 - 192.168.1.41 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/87.0.4280.141+Safari/537.36 - 500 50 5 54
question from:
https://stackoverflow.com/questions/65923871/iis-10-web-config-throwing-500-for-uploaded-files-such-as-images-pdf-docx 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…