Problem when installing in subfolder

More
3 months 4 weeks ago - 3 months 4 weeks ago #183763 by lcnittl
I might jump in on that point and revive this old topic, as I am experiencing the same issues as the OP 2 years ago.
After massive experimenting I came up with a configuration that allows serving of the admin page, however with broken css. On clicking on the 'Start installation' button, the URL changed/redirected from
https://servername.com/survey/index.php?r=installer/welcome
to
https://servername.com/index.php?r=installer/welcome
. Well, already the broken interface is a hint that something is not working correctly.
File Attachment:

I was able to dirty-fix this look-issue by adding '/survey/' instead of '/' in the 'config-defaults.php' where 'publicurl' is defined (lines 621 and 623), however, the link would still give the wrong URL.

I am using the following setup:
The latest LimeSurvey release (limesurvey3.17.1+190408.zip).

An nginx reverse proxy that handles http to https redirects, and proxy passes the requests to different backend servers based on location (f.e. /survey/ to the limesurvey webserver). The backend server then proxy passes php requests to php-fpm.

The config of the frontend reverse proxy:
http{
    [..some stuff..]
 
    include /etc/nginx/proxy_params;
 
    [..some stuff..]
 
    server {
        listen 80 default_server;
        listen [::]:80 default_server;
 
        return 301 https://$host$request_uri;
    }
 
    server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
 
        [..all the SSL stuff..]
 
        [..other locations..]
 
        location /survey/ {
            #include /etc/nginx/proxy_params;  # included in http context
            proxy_pass http://192.168.3.13/;
        }
    }
}

The proxy_params file:
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Ssl on;

The config of the limesurvey backend nginx (IP:192.168.3.13; 'snippets/fastcgi-php.conf' as of Debian9 nginx installation)
http{
    [..some stuff..]
 
    sever{
        listen 80;
        server_name _;
 
        root /var/www/html/limesurvey;
        index index.html index.htm index.php;
        charset UTF-8;
 
        try_files $uri $uri/ /index.php?r=$uri&$args;
 
        location ~ [^/]\.php(/|$) {
            include snippets/fastcgi-php.conf;
 
            # Mitigate https://httpoxy.org/ vulnerabilities
            fastcgi_param HTTP_PROXY "";
 
            fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        }
    }
}

Any ideas what I am overseeing? Any help appreciated!
Last edit: 3 months 4 weeks ago by lcnittl.

Please Log in or Create an account to join the conversation.

More
3 months 4 weeks ago #183770 by DenisChenu
try_files $uri $uri/ /index.php?r=$uri&$args; … is the issue …

Did you check with
try_files $uri $uri/ /survey/index.php?r=$uri&$args;

And : why did you try to fix url before installing ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand .
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

More
3 months 4 weeks ago #183773 by lcnittl

Did you check with
try_files $uri $uri/ /survey/index.php?r=$uri&$args;


Yes - unfortunately the same behavior.

And : why did you try to fix url before installing ?


Do you mean altering of 'config-defaults.php'? After finding the right proxy settings that do not lead to a redirect from
https://servername.com/survey/<file|folder/|folder>
to
https://servername.com/<file|folder/|folder>
in any case, I assumed that this redirect must come from LimeSurvey or something inside it. During investigation of the right nginx setup, I also found the last line
Yii::createApplication('LSYii_Application', $config)->run();
in '/index.php' caused this behavior (Also as seen by OP) - this was at a state where I could not even reach the index file, as
https://servername.com/survey/admin
would directly redirect to
https://servername.com/index.php?r=installer/welcome
if I remember correctly.

Searching the web I found plenty of "manuals" stating that something like this can be fixed by altering 'publicurl' or 'baseUrl' in 'config.php'. As this file is not existing in my case (I guess the missing installation that I cannot start), I put this adaption in 'config-defaults.php' (Willing to take care of this after installation).

I forgot to mention that the exact same setup is successfully serving 2 other website/applications, one of the gitea. In both cases the 'try_files' directive does not contain the subfolder path. In fact, the backends do not know their subfolder name on the frontend reverse proxy (well, at least not in a static manner, like written in a config file).

Please Log in or Create an account to join the conversation.

More
3 months 4 weeks ago #183776 by DenisChenu

lcnittl wrote:

And : why did you try to fix url before installing ?


Do you mean altering of 'config-defaults.php'? After finding the right proxy settings that do not lead to a redirect from

No,

Default nginx config
The try_files $uri $uri/ /index.php?r=$uri&$args; is not from nginx default config.

Did you try to disable it ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand .
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

More
3 months 4 weeks ago #183777 by lcnittl
Yes, also without this try_files directive the result is the same. (So same config as before, with this line commented)

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!