Daniel15 / simple-nuget-server

A very simple PHP NuGet server
MIT License
116 stars 43 forks source link

Simple NuGet Server

A very simple NuGet server for my personal use, similar to NuGet.Server but in PHP. Designed for scenarios where a single user (ie. a person or a build server) pushes packages.

Features

Setup

For a Debian-based distro (including Ubuntu), installation is something along the lines of what I've written below. Installation using other Linux distributions will vary but it should be pretty similar.

1 - Ensure all dependencies are installed:

Note: If using Nginx, please make sure ngx_http_dav_module is installed. This is required to enable HTTP PUT support.

2 - Copy app to your server, you could do a Git clone on the server or add it as a Git submodule if adding to a site that's already managed via Git:

cd /var/www
git clone https://github.com/Daniel15/simple-nuget-server.git
# Make db and packages directories writable
chown www-data:www-data db packagefiles
chmod 0770 db packagefiles

3 - Ensure you have a PHP 5.4+ or HHVM upstream configured. For example, in /etc/nginx/conf.d/php.conf:

upstream php {
    server unix:/var/run/php7.2-fpm.sock;
}

4 - Copy nginx.conf.example to /etc/nginx/sites-available/nuget and modify it for your environment:

5 - Edit inc/config.php and change ChangeThisKey to a randomly-generated string

6 - Enable the site (if creating a new site)

ln -s /etc/nginx/sites-available/nuget /etc/nginx/sites-enabled/nuget
/etc/init.d/nginx reload

7 - Set the API key and test it out. I test using nuget.exe (which is required for pushing)

nuget.exe setApiKey -Source http://example.com/ ChangeThisKey
nuget.exe push Foo.nupkg -Source http://example.com/

(if using Mono, run mono nuget.exe instead)

Licence

(The MIT licence)

Copyright (C) 2014 Daniel Lo Nigro (Daniel15)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.