1

I'm trying to use a subfolder for containing web app on my server. For example : example.com/netdata ===> Netdata monitoring example.com/passbolt ====> Password manager etc ..

For making things work i've used this config :

#Passbolt
server {
    listen 80 default_server;
    listen [::]:80 default_server;
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;

    ssl_certificate /etc/nginx/ssl/cert.pem;
    ssl_certificate_key /etc/nginx/ssl/key.pem;

    allow all;
    root /var/www/html/;
    server_name passbolt.local;

    location /passbolt/ {   
        alias /var/www/html/passbolt/app/webroot/;
        try_files $uri $uri/ /index.php?$args;

        location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
        }

    }


}

But i got always a 403 forbiden error, so i've check permission on each file but all of these are owned by www-data which is the user for my nginx server..

I'm on Debian 8 .

Anybody can help me ?

EDIT 1 : in log i got this error :

2017/04/24 16:07:08 [error] 28301#0: *2 directory index of "/var/www/html/passbolt/app/webroot/" is forbidden, client: 192.168.122.1, server: passbolt.local, request: "GET /passbolt/ HTTP/1.1", host: "passbolt.local"
1

Add this:

  location / {
    index index.htm index.html index.php index.py index.cgi index.sh;
  }

http://nginxlibrary.com/enable-directory-listing/

0

Okay so i've found a solution. My apps is working with cakephp and with this framework you need to take care of URL rewriting and other things like that.

Here is my configuration in Nginx to get things work :

#Passbolt
server {
    listen 80 default_server;
    listen [::]:80 default_server;
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;

    ssl_certificate /etc/nginx/ssl/cert.pem;
    ssl_certificate_key /etc/nginx/ssl/key.pem;

    root /var/www/html/;
    server_name passbolt.local;

    location /passbolt {    
         if (-f $request_filename) {
                    break;
            }

            # Avoid recursivity
            if ($request_uri ~ /webroot/index.php) {
                    break;
            }

            rewrite ^/passbolt$ /passbolt/ permanent;
            rewrite ^/passbolt/app/webroot/(.*) /passbolt/app/webroot/index.php?url=$1 last;
            rewrite ^/passbolt/(.*)$ /passbolt/app/webroot/$1 last;

        location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        }

    }
}

Thank a lot for help !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.