Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to write nginx rewrite rules for clean URLs.

Everytime the user hits;

I need to execute

Now my regex is right as per rubular:


and rule is

if (!-e $request_filename) {
  rewrite ^\/abc\/(\d+)\/(\d+)\/(\w+\S+)$ abc.php?a=$1&b=$2&c=$3 last;

But it is giving "No input File specified". I cant find what the problem is?

share|improve this question
Do it the easy way! Get a .htaccess example, and convert it here: – matrixdevuk Mar 18 '14 at 2:06

"No input File specified" error is coming form php-handler. This means rewrite rule is working fine but some other line is not prefixing proper base_dir.

Try this...


rewrite ^\/abc\/(\d+)\/(\d+)\/(\w+\S+)$ abc.php?a=$1&b=$2&c=$3 last;


rewrite ^\/abc\/(\d+)\/(\d+)\/(\w+\S+)$ /abc.php?a=$1&b=$2&c=$3 last;

Please note / (slash) before abc.php in above line.

Also problem can be...

  1. In location ~ \.php$ {} block. I hope u have one for sure in your full config :-)
  2. There must be a line like - root /var/www/; in your config. If its in location \ {..} block, you may need to copy it to the location ~ \.php$ {} or move outside location \ {..} but inside server {..} block.

If you can paste your nginx config here, it will be easier to debug. :-)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.