我可以如何设置一个参数在nginx下的参数?

在Apache下我可以很容易地设置索引。 喜欢:

DirectoryIndex index.php?parameter = xyz

我怎样才能在nginx中设置?

我曾试过:index index.php?parameter = xyz但是我得到了一个403错误。

我不确定这是你在找什么,但它实际上是一个API:

资料来源: 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 } 

很明显,这些例子是针对try_files的,但是参数是相同的。这只是一个使用它们的例子。

在nginx中,索引选项是文件。 但我认为你可以尝试:

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

如果它不起作用,为什么不只是使用index index2.php然后在你的index2.php你redirect到index.php?q = 1?