FAQ

Page Discussion History

Difference between revisions of "SilverStripe"

m (Adding the line "fastcgi_param SCRIPT_NAME /sapphire/main.php;", thanks to http://www.silverstripe.org/general-questions/show/16066)
 
Line 1: Line 1:
 
[http://www.silverstripe.org/ SilverStripe] is a modern PHP based CMS Framework that runs happily on nginx.  There are several built in failsafes that will attempt to rectify any errors in rewrite rules.  First, SS relies on an .htaccess file to define how to handle URLs.  Second, in the event that rewriting has failed the index.php file will attempt to set internal variables and include the core /sapphire/main.php file for processing.
 
[http://www.silverstripe.org/ SilverStripe] is a modern PHP based CMS Framework that runs happily on nginx.  There are several built in failsafes that will attempt to rectify any errors in rewrite rules.  First, SS relies on an .htaccess file to define how to handle URLs.  Second, in the event that rewriting has failed the index.php file will attempt to set internal variables and include the core /sapphire/main.php file for processing.
  
'''These instructions assume you are using PHP configured as [[PHPFcgiExample|Fast CGI]] or [[NginxPHPFPM|PHP-FPM]] listening on 127.0.0.1:9000.'''  Make any appropriate changes fastcgi_params as needed for your environment.
+
'''These instructions assume you are using PHP configured as [[PHPFcgiExample|Fast CGI]] or PHP-FPM listening on 127.0.0.1:9000.'''  Make any appropriate changes fastcgi_params as needed for your environment.
  
 
The basic rewrite that controls all SilverStripe calls involve passing the URI and any GET vars to <tt>$document_root/sapphire/main.php</tt>.
 
The basic rewrite that controls all SilverStripe calls involve passing the URI and any GET vars to <tt>$document_root/sapphire/main.php</tt>.

Revision as of 00:45, 9 February 2012

SilverStripe is a modern PHP based CMS Framework that runs happily on nginx. There are several built in failsafes that will attempt to rectify any errors in rewrite rules. First, SS relies on an .htaccess file to define how to handle URLs. Second, in the event that rewriting has failed the index.php file will attempt to set internal variables and include the core /sapphire/main.php file for processing.

These instructions assume you are using PHP configured as Fast CGI or PHP-FPM listening on 127.0.0.1:9000. Make any appropriate changes fastcgi_params as needed for your environment.

The basic rewrite that controls all SilverStripe calls involve passing the URI and any GET vars to $document_root/sapphire/main.php.

  1. Remove the .htaccess file and index.php in the root of your SilverStripe installation (Just to be sure)
  2. Apply a config similar to the following:
server {
    listen       80;
    server_name  my-totally-awesome-site.tld;
    root         /PATH/TO/YOUR/SS/ROOT;
 
    location / {
        try_files $uri @silverstripe;
    }
 
    location @silverstripe {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root/sapphire/main.php;
	fastcgi_param SCRIPT_NAME /sapphire/main.php;
        fastcgi_param QUERY_STRING url=$uri&$args;
        fastcgi_pass  127.0.0.1:9000;
    }
}

This has been tested with SS 2.3 and 2.4.