Xibo nginx 405 errors

Hi,

I´ve installed the latest xibo cms server (2.1.2) on nginx. The cms works fine so far, but I can´t save any setting. I get a 405 error on saving. I´ve tried different nginx configurations, which I found here, but no configuration works. This is my last nginx config state:

server {
    listen 80;
    listen [::]:80;
		server_name xibo.xy.de;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
		server_name xibo.xy.de;
    ssl_certificate /etc/letsencrypt/live/xibo.xy.de/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/xibo.xy.de/privkey.pem;
    add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";

		access_log /var/log/access.log combined;
		error_log /var/log/error.log;
		root /var/www/xibo/htdocs/xibo/web;
		index index.php index.html index.htm;

		location / {
			try_files $uri $uri/ @rewrites;
		}

    location /api/authorize {
            try_files $uri /api/authorize/index.php?args;
    }

		location /api {
			try_files $uri /api/index.php?$args;
		}

		location /install {
			try_files $uri /install/index.php?$args;
		}

		location /maint {
			try_files $uri /maint/index.php?$args;
		}

		location /maintenance {
			try_files $uri /index.php?$args;
		}

    location ~ \.php {
            try_files $1 = 404;
            include /etc/nginx/fastcgi_params;
            fastcgi_split_path_info ^(.+\.php)(/.+)\$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            #fastcgi_param  SCRIPT_NAME      $fastcgi_script_name;
            #fastcgi_param HTTPS on;
            fastcgi_pass unix:/var/run/php/php7.3-fpm-xibo.sock;
            fastcgi_index index.php;
			# This is for a proper working of WSDL clients
			if ($request_method = 'OPTIONS') {
				add_header 'Access-Control-Allow-Origin' "$http_origin";
				add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
				add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,MessageType,SOAPAction';
				add_header 'Access-Control-Max-Age' 1728000;
				add_header 'Content-Type' 'text/plain charset=UTF-8';
				add_header 'Content-Length' 0;
				return 204;
			}
			if ($request_method = 'POST') {
				add_header 'Access-Control-Allow-Origin' '*';
				add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
				add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
			}
			if ($request_method = 'GET') {
				add_header 'Access-Control-Allow-Origin' '*';
				add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
				add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
			}
		}
		# To enable nginx direct file downloads
		location /download {
			internal;
			alias /var/www/xibo/library;
		}
}

Has anyone a hint? It should be possible to run this software with nginx, shouldn´t it?

I’m also running into the 405 error, but I am running IIS 10 and Xibo 2.1.0. I posted a topic on it yesterday, hoping to find a resolution soon. Good luck.

This is my profile, you can try it out

server {
listen 80;
server_name xibo.ito.fyi;
root /var/www/xibo/web;
client_max_body_size 500M;
client_body_timeout 1200;
error_page 500 502 503 504 /50x.html;
error_log /var/log/nginx/xibo_error.log error;
access_loe /var/log/nginx/xibo_access.log main;
index index.php index.html index.htm;

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

location = 50x.html {
	root /usr/share/nginx/html;
}

location ~ /.php$ {
    fastcgi_apss unix:/run/php/php7.4-fpm.sock;
	fastcgi_param SCRITP_FILENAME $document_root/$fastcgi_script_name;
	include fastcgi_params;
}

location ~/\.ht {
    den all;
}

location /api {
    try_files $uri /api/index.php?$args;
}

location /api/authorize {
    try_files $uri /api/authorize/index.php?$args;
}

location /maint {
    try _flies $uri /maint/index.php?$args;
}

location /maintenance {
    try_files $uri /maintenance/index.php?$agrs;
}
}

My Xibo
1572632774064

You may also need to execute chmod -R www-data:www-data /var/www/xibo

1 Like

Thanks - my try files directive was the problem. The fully working host has to be:

server {
    listen 80;
    listen [::]:80;
		server_name xibo.xy.de;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
		server_name xibo.xy.de;
    ssl_certificate /etc/letsencrypt/live/xibo.xy.de/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/xibo.xy.de/privkey.pem;
    add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";

		access_log /var/log/access.log combined;
		error_log /var/log/error.log;
		root /var/www/xibo/htdocs/xibo/web;
		index index.php index.html index.htm;

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

    location /api/authorize {
            try_files $uri /api/authorize/index.php?args;
    }

		location /api {
			try_files $uri /api/index.php?$args;
		}

		location /install {
			try_files $uri /install/index.php?$args;
		}

		location /maint {
			try_files $uri /maint/index.php?$args;
		}

		location /maintenance {
			try_files $uri /index.php?$args;
		}

    location ~ \.php {
                try_files $uri =404;
                include /etc/nginx/fastcgi_params;
                fastcgi_split_path_info ^(.+\.php)(/.+)\$;
                fastcgi_param  SCRIPT_FILENAME  $document_root/$fastcgi_script_name;
                fastcgi_param HTTPS on;
                fastcgi_pass unix:/var/run/php/php7.3-fpm-xibo.sock;
                fastcgi_index index.php;

			# This is for a proper working of WSDL clients
			if ($request_method = 'OPTIONS') {
				add_header 'Access-Control-Allow-Origin' "$http_origin";
				add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
				add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,MessageType,SOAPAction';
				add_header 'Access-Control-Max-Age' 1728000;
				add_header 'Content-Type' 'text/plain charset=UTF-8';
				add_header 'Content-Length' 0;
				return 204;
			}
			if ($request_method = 'POST') {
				add_header 'Access-Control-Allow-Origin' '*';
				add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
				add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
			}
			if ($request_method = 'GET') {
				add_header 'Access-Control-Allow-Origin' '*';
				add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
				add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
			}
		}
		# To enable nginx direct file downloads
		location /download {
			internal;
			alias /var/www/xibo/library;
		}
}