'Primary' domain in server block?

Francis Daly francis at daoine.org
Fri Mar 8 20:42:40 UTC 2013

On Fri, Mar 08, 2013 at 08:53:34AM +0000, Tom Barrett wrote:
> On 7 March 2013 17:06, Francis Daly <francis at daoine.org> wrote:
> > On Thu, Mar 07, 2013 at 09:30:01AM +0000, Tom Barrett wrote:

Hi there,

> I think perhaps my use of the word 'integration' was a little
> grandiose. The general server setup is PHP fastcgi with a WordPress
> installation.

So: fastcgi is involved.

nginx interacts with the fastcgi server by sending key/value pairs from
fastcgi_param directives. That is (pretty much) all it does.

The fastcgi server will (typically) use some specific fastcgi_param
keys for itself, and then make all of the key/values available to the
php script.

What happens after that is nothing to do with nginx.

> > > How is PayPal doing that?
> >
> > Presumably you're giving the information it to PayPal somehow?
> So, however PayPal is grabbing it's information, it gets the first entry in
> the server_name directive. And that's my only option?

No. It sounds like your php script is talking to PayPal, and so your php
script is sending the information. If you know what information you want
to send, either change your php script to send only that; or else read
your php script to see what key names it uses, and change your nginx to
send the values you want for those keys.

> Well, assuming my above statement is correct, then only the server_name
> directive is relevant?

That depends on what your php script does.

> It is a pretty trivial setup: http://pastebin.com/SdaB1ZW4

My guess is that your php script uses the value of SERVER_NAME when it
talks to PayPal. Your config sets SERVER_NAME to whatever $server_name is
(in the fastcgi_param directives, in the "include" file).

If my guess is correct, then if you send SERVER_NAME with the value of
"www.example.com", then that's what PayPal will see, and will use.

You have the php script; you don't need to guess.

You can set a fixed string, or you can use another variable -- perhaps
$host is closer to what you want it to be. Or maybe PayPal will use some
other key if SERVER_NAME is not set to anything. It shouldn't be too
difficult to set up a test system to learn some of what PayPal is doing.

Good luck with it,

Francis Daly        francis at daoine.org

More information about the nginx mailing list