Hi guys,
I just finised installing Klipper / Mainsail on my setup and http://<printer_ip>/printer/info shows state "ready", so im pretty sure, the setup is fine. Only problem is that my web interface doesn't work properly. i get a 403 error. I think the problem is that nginx can't access the ~/pi/mainsail data, but i dont have enough experience with nginx to set those permissions. Can somebody please help me with that? I found some stuff about a www-data user but don't know anything about how that works.
Thanks in advance!
#[SOLVED] 403 Error on mainsail.local // nginx error 13 permission denied
1 messages ยท Page 1 of 1 (latest)
how do you installed mainsail (or the complete system)?
i used the manual install guide on top of a armbian on bananapi m2 zero
the permissions for ~/mainsail are 755 and 644 for files, so that should be ok i guess
ok. than i think its a wrong path in your nginx config
pls post the output of:
ls -lt /home
total 4
drwx------ 17 pi pi 4096 Jan 21 15:19 pi
and then:
ls -lt /home/pi
total 40
drwxr-xr-x 5 pi pi 4096 Jan 21 15:02 mainsail
drwxr-xr-x 2 pi pi 4096 Jan 21 14:04 klipper_config
drwxr-xr-x 2 pi pi 4096 Jan 21 13:41 klipper_logs
drwxr-xr-x 8 pi pi 4096 Jan 21 13:41 printer_data
drwxr-xr-x 5 pi pi 4096 Jan 15 17:47 moonraker-env
drwxr-xr-x 8 pi pi 4096 Jan 15 17:35 moonraker
drwxr-xr-x 2 pi pi 4096 Jan 15 17:31 gcode_files
drwxr-xr-x 5 pi pi 4096 Jan 15 17:09 klippy-env
drwxr-xr-x 11 pi pi 4096 Jan 15 16:16 klipper
drwxr-xr-x 7 pi pi 4096 Jan 14 16:56 kiauh
ok. and now the content of your nginx config
(your file structur looks also wrong)
user www-data;
worker_processes auto;
pid /run/nginx.pid;
error_log /var/log/nginx/error.log;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
##
# Gzip Settings
##
gzip on;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
#mail {
# See sample authentication script at:
# http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
# auth_http localhost/auth.php;
# pop3_capabilities "TOP" "USER";
# imap_capabilities "IMAP4rev1" "UIDPLUS";
server {
listen localhost:110;
protocol pop3;
proxy on;
}
server {
listen localhost:143;
protocol imap;
proxy on;
}
#}
An example NGINX configuration that uses a PHP script on an Apache server as the IMAP auth backend.
your mainsail config pls. not the generic one
sites-enabled/mainsail?
i dont know which guide you use. when this was the config file you added in your guide, then yes.
its too long for copy paste
i did this:
mkdir ~/mainsail
sudo rm /etc/nginx/sites-enabled/default
sudo ln -s /etc/nginx/sites-available/mainsail /etc/nginx/sites-enabled/
sudo systemctl restart nginx
2023/01/21 15:13:39 [crit] 4042#4042: *12 stat() "/home/pi/mainsail/favicon.ico" failed (13: Permission denied), client: IPI, server: _, request: "GET /favicon.ico HTTP/1.1", host: "IP", referrer: "http://IP/"
2023/01/21 15:13:39 [error] 4042#4042: *12 open() "/home/pi/mainsail/index.html" failed (13: Permission denied), client: IP, server: _, request: "GET /favicon.ico HTTP/1.1", host: "IP", referrer: "http://IP/"
these over and over for every page refresh
open() "/home/pi/mainsail/index.html" failed
stat() "/home/pi/mainsail/" failed (13: Permission denied)
pls post the output of:
ls -lt /home/pi/mainsail
total 44
-rw-r--r-- 1 pi pi 17975 Dec 10 19:29 sw.js
drwxr-xr-x 2 pi pi 4096 Dec 10 19:29 assets
-rw-r--r-- 1 pi pi 1731 Dec 10 19:29 index.html
-rw-r--r-- 1 pi pi 435 Dec 10 19:29 manifest.webmanifest
-rw-r--r-- 1 pi pi 123 Dec 10 19:29 config.json
drwxr-xr-x 2 pi pi 4096 Dec 10 19:29 fonts
drwxr-xr-x 3 pi pi 4096 Dec 10 19:29 img
my pi user has a password, i dont remember if this is the default, but is this a problem with this config?
no. this should not be an issue
pls post the output of:
ls -lt /etc/nginx/sites-available
total 8
-rw-r--r-- 1 root root 2017 Jan 21 13:48 mainsail
-rw-r--r-- 1 root root 2412 Dec 20 10:36 default
oh sry. wrong:
ls -lt /etc/nginx/sites-enabled
lrwxrwxrwx 1 root root 35 Jan 21 13:48 mainsail -> /etc/nginx/sites-available/mainsail
total 0 in front
pls upload you full nginx log
the /var/log/nginx/mainsail-error.log?
and access pls
if you have any idea what the problem is, let me know please ๐
i tested it now on my orange pi 4 lts with a clear flashed armbian and just use this guide from top to bottom: https://docs.mainsail.xyz/setup/manual-setup/mainsail
i only have to install unzip, because it was not in this guide, but i can open the interface without issues
thanks a lot for testing this again! i think i will look into this again on the weekend.
The solution was to change one line in the nginx config from "user www" to "user pi". Now it works flawlessly ๐