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.


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

Source: http://wiki.nginx.org/HttpCoreModule

    # 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.


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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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