Silverstripe on nginx

Discussion in 'Installation/Configuration' started by badenzer, Feb 17, 2014.

  1. badenzer

    badenzer New Member

    Hi.

    I had installed Silverstripe on nginx with SilverStripe 3.1.2 on Debian 7.
    When I install Silverstripe in the default root directory, all works very well.
    But when I want to install it to an subdir like /cms, I can do the setup and the site will show up successfully. But when I open the site new, I get an Error 404.

    I used this nginx Directives in ISPconfig:

    Code:
    location ^~ /assets/ {
                    try_files $uri =404;
                    expires max;
                    access_log off;
                    log_not_found off;
           }
           location ~ \.ss {
                    allow 127.0.0.1;
                    deny all;
           }
           location ~ web\.config {
                    deny all;
           }
           location ~ \.(ya?ml|bak|swp)$ {
                    deny all;
           }
           location ~ ~$ {
                    deny all;
           }
           location ^~ /silverstripe-cache/ {
                    deny all;
           }
           location ^~ /vendor/ {
                    deny all;
           }
           location ~ /composer\.(json|lock) {
                    deny all;
           }
           location ~ ^/framework/(.+/)?(main|rpc|tiny_mce_gzip)\.php$ {
                    try_files /6c1ec1bb21001dd913db95cfb05d78d7.htm @php;
           }
           location ~ ^/(cms|framework|mysite)/.+\.(php|php[345]|phtml|inc)$ {
                    deny all;
           }
           location ~ ^/(cms|framework)/silverstripe_version$ {
                    deny all;
           }
    
           error_page 404 /assets/error-404.html;
           error_page 500 /assets/error-500.html;
    
           location / {
                     if (!-f $request_filename) {
                        rewrite ^/(.*?)(\?|$)(.*)$ /framework/main.php?url=$1&$3 last;
                     }
           }
    
           location ~ ^/(index|install)\.php/ {
                    fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
                    include /etc/nginx/fastcgi_params;
                    fastcgi_pass unix:/var/run/php5-fpm.sock;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
           }
    
           location ~ \.php$ {
                    try_files /6c1ec1bb21001dd913db95cfb05d78d7.htm @php;
           }
    
           location @php {
                    try_files $uri =404;
                    include /etc/nginx/fastcgi_params;
                    fastcgi_pass unix:/var/run/php5-fpm.sock;
                    fastcgi_index index.php;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    fastcgi_intercept_errors on;
                    fastcgi_temp_file_write_size 10m;
                    fastcgi_busy_buffers_size    512k;
                    fastcgi_buffer_size          512k;
                    fastcgi_buffers           16 512k;
                    fastcgi_read_timeout 1200;
           }
    
    from timmehosting.de.
    This works fine as long as I install it to the root dir for example
    /var/www/clients/clientx/webx/web/

    How to change this for the Subdir like /cms/ ?
    For example:
    /var/www/clients/clientx/webx/web/cms/

    I changed the Directives to fit for me (like I thought), but it won't work.

    I hope anyone can help me.

    With kind regards,
    badenzer
     

Share This Page