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

under Apache I can set the index very easy. Like:

DirectoryIndex index.php?parameter=xyz

How can I set this in nginx?

I had tried: index index.php?parameter=xyz but I get an 403 error.

share|improve this question

In nginx, options for index are files. But I think you can try:

index index.html /index.php?q=1

If it does not work, why don't just use index index2.php then in your index2.php you redirect to index.php?q=1?

share|improve this answer

I'm not sure if this is what you are looking for, but its practically an API:


    # wordpress (without WP Super Cache) - example 1
    try_files $uri $uri/ /index.php?q=$uri&$args;

    # wordpress (without WP Super Cache) - example 2 
    # It doesn't REALLY need the "q" parameter, but without an explicit $args php 
    # gets an empty QUERY_STRING, breaking generated responses that don't use a 
    # permalink, such as search results.
    try_files $uri $uri/ /index.php?$args;

    # joomla
    try_files $uri $uri/ /index.php?q=$uri&$args;

     location ~ \.php$ {
          fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    # if not already defined in the fastcgi_params file
     # any other specific fastcgi_params

Obviously those examples are for the try_files, but parameters would be the same passed in. This is just an example where they are used.

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.