mlazarov/supervisord-monitor

Running it from webroot subfolder

goldencut opened this issue · 7 comments

Hi,
I have a management server (runs nginx) where I keep a lot of web-based tools, each in its own webroot subfolder, that I use to manage servers. I added supervisord-monitor there to its own subfolder, and it runs but it looks really ugly as if no css is loaded etc. Any chance of getting it to work there?
screenshot 2018-03-12 15 45 51

BR,
G.

I also have the same issue. Please send suggestion on how to run from subfolder

You need to see nginx log. May be user's authorization is not ok.

YOzaz commented

Hi! You should modify your application config:
https://github.com/mlazarov/supervisord-monitor/blob/master/application/config/config.php
In our case, we had to amend these lines:

$config['base_url'] = '';   // change to your absolute or relative URL
$config['index_page'] = '';   // change to 'index.php' if you don't have rewrite configured

@mlazarov my suggestion would be adding this file into .gitignore, or leave base_url empty so it works on relative paths as well.

Thanks to @YOzaz, I got the UI part working. But clicking on any of the server's service controls (https://my_server/supervisord-monitor/public_html/index.php/control/stopall/server01) I still get '404 Not Found'. Nginx gives "[error] 23778#0: *392955 open() "/var/www/html/supervisord-monitor/public_html/index.php/control/stopall/server01" failed (20: Not a directory)".. What is the correct link and should happen when I click on that control?

BR,
M.

YOzaz commented

@goldencut you should check your nginx configuration and rewrite rules - it looks like either they're strict (looking for exact path), either rewrite is not configured.

Ok, so it seems I got the controls maybe working with:
try_files $uri $uri/ /supervisord-monitor/public_html/index.php$is_args$args;
But for some reason I get blank page when I configure some remote server IP in config .. :/

nginx+php, run this app, as follow setups:

cat /etc/redhat-release

Red Hat Enterprise Linux Server release 7.4 (Maipo)
#vim /etc/nginx/nginx.conf
add server section in http
server {
listen 80;
server_name localhost;
index index.html index.htm index.php;
root /home/supervisord-monitor/public_html; 指向web应用的映射目录
#autoindex on;
#charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        #root   html;
        #index  index.html index.htm index.php;
        #try_files $uri $uri/ /index.php;
        try_files $uri $uri/ /index.php?s=$uri&$args;
    }
    location ~ [^/]\.php(/|$) {
        try_files $uri =404;
        fastcgi_pass 127.0.0.1:9000;  
        fastcgi_index index.php;
        include fastcgi.conf;   
        set $real_script_name $fastcgi_script_name;
        if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
             set $real_script_name $1;
             set $path_info $2;
        }
        fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
        fastcgi_param SCRIPT_NAME $real_script_name;

    }

othersides, create fastcgi.conf

vim fastcgi.conf

fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

start php-fpm and nginx