GithubHelp home page GithubHelp logo

nginx config? about cockpit HOT 19 CLOSED

agentejo avatar agentejo commented on May 12, 2024
nginx config?

from cockpit.

Comments (19)

lhardie avatar lhardie commented on May 12, 2024 5

Just in case anyone has issues still ( I did today ), the following nginx config worked for me:

server {
    listen 80;
    server_name _ myCockpit.com;
    root /var/www/html/cockpit-master;
    index index.php;

    location / {
      try_files $uri $uri/ /index.php;
    }

    access_log  /var/log/nginx/cockpit.access.log;
    error_log   /var/log/nginx/cockpit.error.log;

    # Deny direct access to .sqlite
    location ~ .sqlite$ {
        deny all;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param COCKPIT_URL_REWRITE On;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
    }

    location ~ /\.ht {
        deny all;
    }
}

from cockpit.

aheinze avatar aheinze commented on May 12, 2024

It seems that $_SERVER['PATH_INFO'] is missing....maybe this site might help: http://wiki.nginx.org/PHPFcgiExample

from cockpit.

MrJuliuss avatar MrJuliuss commented on May 12, 2024

Hi, same issue but i have this line, any idea ?

from cockpit.

s8m avatar s8m commented on May 12, 2024

Same here. Install worked, but I can't get past that.

from cockpit.

aheinze avatar aheinze commented on May 12, 2024

does this information help?

http://stackoverflow.com/questions/15316742/nginx-configuration-php-frameworks-with-pathinfo-404

I'll try to setup a nginx env in the next days to replicate the issue.

from cockpit.

s8m avatar s8m commented on May 12, 2024

Unfortunately I didn't have any luck with the suggestions in that Stack Overflow thread. But I'm anxious to see what you find!

from cockpit.

aheinze avatar aheinze commented on May 12, 2024

I updated the cockpit code and would appreciate it if you could test it. Please download the latest master:

https://github.com/aheinze/cockpit/archive/master.zip

and add the following rule to your server config:

location /cockpit {
     try_files $uri $uri/ /cockpit/index.php;
}

change cockpit to the folder name you extracted the cockpit zip.

Thanks for testing and feedback!

from cockpit.

MrJuliuss avatar MrJuliuss commented on May 12, 2024

Hi, no change for me :(

from cockpit.

aheinze avatar aheinze commented on May 12, 2024

could you please provide you server config?

from cockpit.

Cidro avatar Cidro commented on May 12, 2024

Same here.
I get redirected to "install" an then nothing :(

from cockpit.

danse-entropy avatar danse-entropy commented on May 12, 2024

http://example.com/cockpit/install works fine and i get redirected to http://example.coom/cockpit which results in an 404. Adding index.php doesn't help, but adding a trailing slash works.

http://example.com/cockpit -- doesn't work
http://example.com/cockpit/index.php -- doesn't work
http://example.com/cockpit/index.php/ -- works

from cockpit.

maxhan avatar maxhan commented on May 12, 2024

Same issue as above,

server {
    listen cockpit:80;
    server_name cockpit;
    access_log /var/log/nginx/cockpit.access.log;
    error_log /var/log/nginx/cockpit.error.log;
    root /srv/cockpit;
    index index.html index.htm index.php;
    location  / {        
        try_files $uri $uri/ /index.php;
    }
    location ~ .sqlite$ {        
        deny all;
    }

    location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info  ^(.+\.php)(.*)$;

        fastcgi_index index.php;
        include fcgi.conf;
        fastcgi_pass unix:/var/run/php-fcgi-cockpit-php-fcgi-2.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    }

}

from cockpit.

bufferUnderrun avatar bufferUnderrun commented on May 12, 2024

I've the same problem, partially solved with this :

  1. verify that all "fastcgi_param" are set
    PATH_INFO, REQUEST_URI, PHP_SELF in priority (used in the index.php). For others params see http://wiki.nginx.org/PHPFcgiExample.
  2. Fix fastcgi path_info
location ~ [^/]\.php(/|$) {
    ...
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    if (!-f $document_root$fastcgi_script_name) {
        return 404;
    }
    ...
}

Now, if i get index.php/auth/login, it works !!!

The last problem i have : if i go to the index.php before being logged, cockpit does not redirect to the login page.

from cockpit.

designermonkey avatar designermonkey commented on May 12, 2024

Just for everyone's info...

PATH_INFO has always been broken on nginx, and it doesn't look like it will be fixed anytime soon, as apparently it is an outdated concept :(

Is there any way that cockpit can be updated to do without this server var?

from cockpit.

aheinze avatar aheinze commented on May 12, 2024

@designermonkey PATH_INFO dependency is now removed in the current release

from cockpit.

designermonkey avatar designermonkey commented on May 12, 2024

Thanks :)

from cockpit.

HamGuy avatar HamGuy commented on May 12, 2024

I had the same issue with the following config:

server {
    listen 80;
    server_name cockpit.dev;
    root /usr/share/nginx/html/cockpit;
    index index.php index.html index.htm;

    error_log /var/log/nginx/cockpit_error.log.txt;
    access_log /var/log/nginx/cockpit_access.log.txt;

    # Add additional types
    include mime.types;

    location / {
        index index.php index.html index.htm;
    }

    # Change "cockpit" to the folder name containing cockpit files.
    location /cockpit {
        try_files $uri $uri/ /cockpit/index.php;
        index index.php index.html index.htm;
    }

    location ~ \.php(/|\?|$) {
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param COCKPIT_URL_REWRITE On;
        include fastcgi_params;
    }

    location ~ .sqlite$ {
        deny all;
    }
}

And the file structure is

/www(root)/cockpit/*

error log is

 "/usr/share/nginx/html/cockpit/auth/login" failed (2: No such file or directory), client: 121.121.121.1, server: cockpit.dev, request: "GET /auth/login HTTP/1.1", host: "cockpit.dev"

from cockpit.

aheinze avatar aheinze commented on May 12, 2024

nginx sample config available here: https://github.com/aheinze/cockpit-docs/blob/master/tutorials/nginx.md

from cockpit.

Tummerhore avatar Tummerhore commented on May 12, 2024

Thank you, lhardie. You're a life saver! I was trying it for the whole day and was always running into the same problem.
Cockpit's documentation strongly needs more detailed installation instructions in this regard.

It seems that the crucial part is the following line:
try_files $uri $uri/ /index.php;

from cockpit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.