Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

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_pass 127.0.0.1:8888;
          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
add comment

Your Answer

 
discard

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.