title: Expose php file on a WordPress hosted site
body: <p>I just launched a WordPress site that has a form to allow users to select something they want to buy.  We are implementing a third-party shopping cart service that requires urls to be in very specific formats.  I want to retrieve the POSTed variables and then issue a redirect (basically a GET) to this third-party shopping cart.  I was going to just create a buy.php file that did just that- retrieve the POST variables and create the url.  </p>
  
  <p>The problem is that I don't know how to expose the buy.php page.  I keep getting routed to the 404.html page.  </p>
  
  <p>I figured I would create a new location that is before all of the others, but the server log complained about not being able to find the file.  Once I fixed that problem, the file wasn't touched, but the request was handled by the 404 page.</p>
  
  <p>The server is running Nginx.  Config is below:</p>
  
  <pre><code>server {
  
    access_log off;
    error_log  /var/log/site-name.com_error_log;
    root /var/www/vhosts/site-name.com/httpdocs;
  
    listen    80;
    listen    443 ssl;
    ssl_certificate /XXX.pem;
    ssl_certificate_key /XXX-cert.key;
  
    # server_name   www.site-name.com ;
    server_name   site-name.com ;
  
    # i can't get this /buy to work
    location /buy/ {
      #  what do I put here to be used in a form Action
    }
  
    location / {
      root   /var/www/vhosts/site-name.com/httpdocs;
      index  index.html index.php index.htm;
          try_files $uri $uri/ /index.php?$args;
    }
  
     location @handler {
      rewrite / /index.php;
    }
  
    location ~ .php/ {
      rewrite ^(.*.php)/ $1 last;
    }
  
    location ~ .php$ {
      try_files $uri /index.php;
      expires off;
      fastcgi_pass 127.0.0.1:8080;
      fastcgi_buffers 256 4k;
      fastcgi_buffer_size 32k;
      fastcgi_busy_buffers_size 256k;
      fastcgi_read_timeout 3600s;
  
  
  #      fastcgi_param HTTPS $fastcgi_https;
      fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
      fastcgi_param MAGE_RUN_CODE default;
      fastcgi_param MAGE_RUN_TYPE store;
  
      include fastcgi_params;
   }
  
  # WordPress single site rules.
  # Designed to be included in any server {} block.
  
  # This order might seem weird - this is attempted to match last if rules below fail.
  # http://wiki.nginx.org/HttpCoreModule
  
     # Add trailing slash to */wp-admin requests.
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;
  
    location ~*  \.(jpg|jpeg|png|gif|ico|css|js|eot|woff|woff2|ttf)$ {
          expires 365d; access_log off; log_not_found off;
    }
  }
  </code></pre>