Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nuget push replies Failed to process request. 'No package file' #14

Open
androidLaLa opened this issue Feb 23, 2016 · 2 comments
Open

Comments

@androidLaLa
Copy link

public/push.php file did not receive $_FILES['package'] => array(0){}

I've installed on my server.

and setting up nginx.conf file like

server{
    ....
}
server{
    ....
}
....
server {
    server_name nuget.myservername.com;

    set $documentRoot /home/web-release/nuget/simple-nuget-server/public;
    root $documentRoot;

    rewrite ^/$ /index.php;
    rewrite ^/\$metadata$ /metadata.xml;
    rewrite ^/search\(\)/\$count$ /count.php;
    rewrite ^/search\(\)$ /search.php;
    rewrite ^/packages\(\)$ /search.php;
    rewrite ^/packages\(id='([^']+)',version='([^']+)'\)$ /findbyid.php?id=$1&version=$2;
    rewrite ^/getupdates\(\)$ /updates.php;
    rewrite ^/findpackagesbyid\(\)$ /findbyid.php;
    # nuget.exe sometimes uses two slashes (//download/blah)
    rewrite ^//?download/([^/]+)/([^/]+)$ /download.php?id=$1&version=$2;
    rewrite ^/([^/]+)/([^/]+)$ /delete.php?id=$1&version=$2;

    # nuget.exe adds /api/v2/ to url when the server is at the root
    rewrite ^/api/v2/package/$ /index.php;
    rewrite ^/api/v2/package/([^/]+)/([^/]+)$ /delete.php?id=$1&version=$2;

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_param SCRIPT_FILENAME $documentRoot/$fastcgi_script_name;
    }

    location = /index.php {
        dav_methods put delete;
        include fastcgi_params;
        fastcgi_pass 127.0.0.1:9000;

        # php doesn't parse request body for put requests, so fake a post.
        fastcgi_param request_method post;
        fastcgi_param http_x_method_override $request_method;
        fastcgi_param SCRIPT_FILENAME $documentRoot/$fastcgi_script_name;
    }

    # used with x-accel-redirect
    location /packagefiles {
        internal;
        root /home/web-release/nuget/simple-nuget-server/public/;
    }
}

is it wrong configuration?

"fastcgi_pass php" to error on my server like this

nginx: [emerg] no port in upstream "php" in /etc/nginx/conf.d/vhost.conf:84
nginx: configuration file /etc/nginx/nginx.conf test failed

so

I've edited "fastcgi_pass php" to "fastcgi_pass 127.0.0.1:9000"
also added fastcgi_param SCRIPT_FILENAME $documentRoot/$fastcgi_script_name;

any solution?

@btoda
Copy link

btoda commented Jan 16, 2017

It might be an issue with the nuget I guess.. I have the same issue... and i checked the $_Files object and it is completely empty. ( I am using apache to host)

@roman-miniailov
Copy link

roman-miniailov commented Mar 20, 2017

Resolved using this Nginx config:

Example of an Nginx configuration for Simple NuGet Server
server {
	listen 80 default_server;
	listen [::]:80 default_server;

	server_name _;
	root /var/www/html/simple-nuget-server/public/;

	rewrite ^/$ /index.php;
	rewrite ^/\$metadata$ /metadata.xml;
	rewrite ^/Search\(\)/\$count$ /count.php;
	rewrite ^/Search\(\)$ /search.php;
	rewrite ^/Packages\(\)$ /search.php;
	rewrite ^/Packages\(Id='([^']+)',Version='([^']+)'\)$ /findByID.php?id=$1&version=$2;
	rewrite ^/GetUpdates\(\)$ /updates.php;
	rewrite ^/FindPackagesById\(\)$ /findByID.php;
	# NuGet.exe sometimes uses two slashes (//download/blah)
	rewrite ^//?download/([^/]+)/([^/]+)$ /download.php?id=$1&version=$2;
	rewrite ^/([^/]+)/([^/]+)$ /delete.php?id=$1&version=$2;

	# NuGet.exe adds /api/v2/ to URL when the server is at the root
	rewrite ^/api/v2/package/$ /index.php;
	rewrite ^/api/v2/package/([^/]+)/([^/]+)$ /delete.php?id=$1&version=$2;

	#location ~ \.php$ {
	#	include fastcgi_params;
	#	fastcgi_pass php;
	#}

	#location = /index.php {
	#	dav_methods PUT DELETE;
	#	include fastcgi_params;
	#	fastcgi_pass php;

	#	# PHP doesn't parse request body for PUT requests, so fake a POST.
	#	fastcgi_param REQUEST_METHOD POST;
	#	fastcgi_param HTTP_X_METHOD_OVERRIDE $request_method;
	#}

	# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
	
	location ~ \.php$ {
		dav_methods PUT DELETE;
		include snippets/fastcgi-php.conf;
		include fastcgi_params;
		
		# With php7.0-cgi alone:
		#fastcgi_pass 127.0.0.1:9000;
		#fastcgi_param REQUEST_METHOD POST;
		#fastcgi_param HTTP_X_METHOD_OVERRIDE $request_method;

		# With php7.0-fpm:
		fastcgi_pass unix:/run/php/php7.0-fpm.sock;
		fastcgi_param REQUEST_METHOD POST;
		fastcgi_param HTTP_X_METHOD_OVERRIDE $request_method;

		
		#fastcgi_index index.php;
	}

	# Used with X-Accel-Redirect
	location /packagefiles {
		internal;
		root /var/www/html/simple-nuget-server/;
	}

	index index.html index.htm index.nginx-debian.html index.php;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants