XSendfile not working - PHP, Apache, Cpanel

后端 未结 2 1586
旧巷少年郎
旧巷少年郎 2021-01-25 04:03

I have been strongly recommended to use XSendfile since we are serving quite large files from our server. The server is running Cpanel. Previously we were using a straight force

相关标签:
2条回答
  • 2021-01-25 04:48

    I hope this will help someone...

    I was having this kind of problem: whenever and whatever -> 0 bytes

    I solve this moving the

    XSendFile On
    XSendFilePath /var/1000italy/data/offline
    

    from the virtualHost section

    <VirtualHost *:80>
    
        DocumentRoot "/var/{{ app_name }}/web"
        ServerName {{ app_name }}.dev
    
        # here was the problem
        XSendFile On
        XSendFilePath /var/1000italy/data/offline
    
        <Directory "/var/{{ app_name }}/web">
            allow from all
            Options -Indexes
            AllowOverride All
        </Directory>
    
        ErrorLog /var/log/apache2/{{ app_name }}_error.log
        CustomLog /var/log/apache2/{{ app_name }}_access.log combined
    
    </VirtualHost>
    

    to the directory section

    <VirtualHost *:80>
    
        DocumentRoot "/var/{{ app_name }}/web"
        ServerName {{ app_name }}.dev
    
        <Directory "/var/{{ app_name }}/web">
            allow from all
            Options -Indexes
            AllowOverride All
    
            # HERE EVERYTHING WORKS FINE
            XSendFile On
            XSendFilePath /var/1000italy/data/offline
        </Directory>
    
        ErrorLog /var/log/apache2/{{ app_name }}_error.log
        CustomLog /var/log/apache2/{{ app_name }}_access.log combined
    
    </VirtualHost>
    

    Ciao

    0 讨论(0)
  • 2021-01-25 04:56

    If you are getting 0 bytes it could be output compression needs disabled,see here for more. For the XSendFilePath not allowed here error that is a syntax problem with your .htaccess. Check it manually if you can to ensure it is in the right place per the documentation.

    0 讨论(0)
提交回复
热议问题