Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Problem when installing in subfolder

  • marvelousvts
  • marvelousvts's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 month ago #148407 by marvelousvts
Replied by marvelousvts on topic Problem when installing in subfolder
I used baseUrl and HostInfo setting in config.php and initially it worked!
But when I click any button e.g. login button or for example to change language I redirect again back to folder.

Is there any additional setting that I should add in config.php in order to have all requests and assets linked to the indicated URL?
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 1 month ago #148409 by holch
Replied by holch on topic Problem when installing in subfolder
Usually you do not need to change anything in the config file. So these changes might have been the problem (if they where not only done after the problems appeared).

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: DenisChenu
The topic has been locked.
More
7 years 1 month ago #148425 by jelo
Replied by jelo on topic Problem when installing in subfolder

marvelousvts wrote: I used baseUrl and HostInfo setting in config.php and initially it worked!
But when I click any button e.g. login button or for example to change language I redirect again back to folder.

Which is no indication that tweaking more and more settings inside the Limesurvey folder will be the answer to your issues. You will continue to get issues with that installation. The webserver seems to have some rewriting of the URL activated. As long as nothing is known about the web server environment it is just guessing. You are currently working against all odds of having a fully working LimeSurvey installation at the end.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
More
4 years 11 months ago - 4 years 11 months ago #183763 by lcnittl
Replied by lcnittl on topic Problem when installing in subfolder
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
Code:
https://servername.com/survey/index.php?r=installer/welcome
to
Code:
https://servername.com/index.php?r=installer/welcome
. Well, already the broken interface is a hint that something is not working correctly.
800

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:
Code:
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:
Code:
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)
Code:
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: 4 years 11 months ago by lcnittl.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 11 months ago #183770 by DenisChenu
Replied by DenisChenu on topic Problem when installing in subfolder
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 , plugin development .
I don't answer to private message.
The topic has been locked.
More
4 years 11 months ago #183773 by lcnittl
Replied by lcnittl on topic Problem when installing in subfolder

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
Code:
https://servername.com/survey/<file|folder/|folder>
to
Code:
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
Code:
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
Code:
https://servername.com/survey/admin
would directly redirect to
Code:
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).
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 11 months ago #183776 by DenisChenu
Replied by DenisChenu on topic Problem when installing in subfolder

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 , plugin development .
I don't answer to private message.
The topic has been locked.
More
4 years 11 months ago #183777 by lcnittl
Replied by lcnittl on topic Problem when installing in subfolder
Yes, also without this try_files directive the result is the same. (So same config as before, with this line commented)
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose