nginx: Install vimbadmin in to subfolder

January 11, 2016 789 views

I tried to install vimbadmin in to subfolder, but i can't. No matter what configuration i use, vimbadmin never work. This is my last configuration

# vimbadmin
location /vimbadmin {
    alias /usr/share/vimbadmin/public;
    index index.php index.html index.htm;
    location ~ ^/vimbadmin/(.*\.(js|css|gif|jpg|png|ico))$ {
        alias /usr/share/vimbadmin/public/$1;

but nginx return me Error: 403 -

*14 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client:, server:, request: "GET /vimbadmin/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: ""

I could not imagine how hard it is.Here is original nginx confiration whick work perfectly on domain/subdomain.

Can you help me with some advices, or example configuration for do that?

Use nginx 1.6.2 with php5-fpm.

1 Answer

Problem is that in your VHOST you define SCRIPT_FILENAME as $document_root$fastcgi_script_name; but you then use the alias direcive to set the path.

Please try to update line 49 to this:

fastcgi_param SCRIPT_FILENAME $request_filename;
  • Thanks for the answer, but not working.
    I update with my last, last nginx configuration, becouse old one is little different.
    With this correction, nginx return me error 404.

  • Today, is a day :)
    I tried again properly setup my nginx configuration and it's worked.
    Thanks a lot @CrypticDesigns for the answer.

    This is my final configuration

    location ^~ /vimbadmin {
            alias /usr/share/vimbadmin/public;
            try_files $uri $uri/ @vimbadmin;
            location ~* \.php {
                include fastcgi_params;
                fastcgi_index index.php;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_param SCRIPT_FILENAME $request_filename;
        location @vimbadmin {
            rewrite ^/vimbadmin/(.*)$ /vimbadmin/index.php?$1 last; # THIS IS THE IMPORTANT LINE
Have another answer? Share your knowledge.