Serve large file with PHP and nginx X-Accel-Redirect

前端 未结 2 1885
隐瞒了意图╮
隐瞒了意图╮ 2020-12-14 05:18

Hi I want user to be able to download PDF file from my server (Windows) configured with nginx PHP. This is my nginx.conf (server block)

http {
    include            


        
2条回答
  •  南方客
    南方客 (楼主)
    2020-12-14 05:42

    Based from recommendation and solution from Danack and some clarification from Carsten, I found that in Windows Serve, we need to set the full path in the alias like this:

    location /protected_files {
                internal;
                alias C:/absolute/path/to/project/protected/;
            }
    

    Please note that the extra forward slash is needed (in my case, Windows 7 Pro on development, Windows Server 2008 for deployment). The only issue is now I need to test concurrent downloads to see if server resources is hogging.

    I'm new with nginx, since it seem really faster that I switch from Apache. Thanks guy for the enlightenment! I'am glad to be part of Stackoverflow community :)

提交回复
热议问题