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.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) p.php?id=$1 [L,QSA] 

How would I change that to work with nginx?

Also, where do I place it?

server {
        listen       80;
        server_name site.com www.site.com;
        root /home/site/public_html;

        location / {
            root   /home/site/public_html;
            index  index.html index.htm;
                proxy_pass http://www.site.com;
                proxy_cache my-cache;
                proxy_cache_valid  200 302  60m;
                proxy_cache_valid  404      1m;
                location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
                        expires 30d;
                }
        }
        location ~ \.php$ {
            root           /home/site/public_html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
}
share|improve this question
    
Where is your try_files? –  Michael Hampton Apr 24 '13 at 17:14
    
what is try_files? –  Jake Thomas Apr 24 '13 at 17:25
add comment

1 Answer

http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files

.. from Example for Drupal/FastCGI

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.