Closed bkraul closed 7 years ago
I haven't had a chance to look at it in detail yet, but @JunielKatarn was working on some changes for Apache compatibility, including updating the rewrite rules: https://github.com/JunielKatarn/simple-nuget-server/commits/apache. There was also an older pull request for it at #3 but it got stale.
Right on man, that was some lightning-fast reply. Thanks.
Hi @bkraul. I recently worked on an apache port. Unfortunately, it's not only about the .htaccess configuration file. Some changes need to be made to the PHP code base.
If you checkout the 'apache' branch of my fork, it should work almost out of the box. Just copy the .htaccess.example file into .htaccess and follow the instructions there.
Thanks @JunielKatarn, will give that a try.
Hey guys, I hit a little snag with @JunielKatarn 's apache branch, but I cannot post an issue on his fork. I was able to successfully set the server up and, successfully push a package to it. The package shows up in the Nuget Package manager in VisualStudio (which is what I am using to consume it), but when I tried to download it, I get an 'Operation failed. Archive size cannot be zero'.
I went ahead and tried the same thing directly on a browser using the call that the package manager sends to the server (GET request), and the file I end up downloading is empty. I can verified that the package I pushed is an actual file. Any idea why I am getting an empty file?
Apparently this is due to the way the file is downloaded, using the X-Accel-Redirect header, which is not available in Apache. I am trying to implement X-Sendfile (after installing mod_xsendfile). Will report on what I find.
If X-Sendfile does not work, I guess the old fashioned readfile() can be used.
Yeah, X-Sendfile
should work in Apache once you install the module. readfile() would work, it's just not as efficient as letting the webserver do it itself (web servers are extremely good at handling static files, particularly around caching / cache validation)
Hi @bkraul. I've enabled issues on my fork. You can raise one there if you want.
I didn't implement X-SendFile logic because I didn't want to make that "non-core" module mandatory. I'm not submitting a PR yet, because my changes may potentially break NGinx deployments, and I haven't had a chance to test that configuration.
Hey guys, X-Sendfile
worked just fine. There is a way to build a logic detection, such as whether we have Nginx or Apache, and then if the mod_xsendfile is enabled, failing back to readfile. I wonder if this would be beneficial.
The other option would be to build this into the Config class (config.php) in order to choose a download method, defaulting toX-Accel-Redirect
, but allowing to do X-Sendfile
or readfile()
. The download.php would then look at this and determine what to use.
Yeah, adding it as a setting in the config class sounds good to me! 😄
Thank you @Daniel15 and @bkraul for your work on this.
Did you guys manage to fix the Apache download issues?
Sorry, I haven't used Apache in a long time so I'm not sure what would need to be done.
Thanks for your project. Is there anyway for you to attach an apache configuration example, like you did the nginx one?
I am having trouble translating the rewrite rules for use in my .htaccess.