XSendfile not working - PHP, Apache, Cpanel

后端 未结 2 1625
旧巷少年郎
旧巷少年郎 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

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

    to the directory section

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

    Ciao

提交回复
热议问题