Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
419 views
in Technique[技术] by (71.8m points)

wordpress - IIS 10 web.config throwing 500 for uploaded files such as images, pdf, docx

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

enter image description here

question from:https://stackoverflow.com/questions/65923871/iis-10-web-config-throwing-500-for-uploaded-files-such-as-images-pdf-docx

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...