zloy / backuppc_on_nginx Goto Github PK
View Code? Open in Web Editor NEWNginx config to host BackupPC frontend
Nginx config to host BackupPC frontend
Hi,
your nginx configuration is unfortunately broken. It allows to circumvent authentication by accessing http://www.example.com/index.cgi instead of http://www.example.com/backuppc/index.cgi.
At least consider removing the root directive altogether and moving location ~ \.cgi$
into the location /backuppc
block.
Regards,
Lukas
Here on nginx of debian buster I had to remove the root
directive as nginx complained.
The working setup to be included in a server directive is:
# BEGIN BACKUPPC
location /backuppc {
allow 127.0.0.1/32;
allow 192.168.100.0/24;
deny all;
access_log /var/log/nginx/backuppc.access.log;
error_log /var/log/nginx/backuppc.error.log;
auth_basic "BackupPC";
auth_basic_user_file /etc/backuppc/htpasswd;
alias /usr/share/backuppc/cgi-bin/;
index /index.cgi;
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}
}
location ~\.cgi$ {
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/run/fcgiwrap.socket;
fastcgi_index BackupPC_Admin;
fastcgi_param SCRIPT_FILENAME /usr/share/backuppc/cgi-bin$fastcgi_script_name;
}
# END BACKUPPC
The config is great but it is not working on centos using an rpm install -- I could use some help getting this working.
The auth_basic
directive should be outside the location blocks, currently it only restricts access to
/image
.
Is there anything missing here. I am getting the following issues:
An error related to perl/cgi and nginx not knowing how to handle it. I have a php site on the same nginx and it handles php fine. Am I missing some other dependent packages?
auth issues. I can't seem to make it take the password file I currently have with it running on lighttpd.
Any help is greatly appreciated.
2017/09/27 23:56:04 [error] 5014#5014: *34 open() "/usr/share/backuppc/cgi-bin/backuppc/image/BackupPC_stnd.css" failed (2: No such file or directory), client: 2.93.191.179, server: _, request: "GET /backuppc/image/BackupPC_stnd.css HTTP/1.1", host: "138.68.101.254"
Real path is /usr/share/backuppc/cgi-bin/image/BackupPC_stnd.css
I think need use "location /" instead "location /backuppc". Or another location for static.
Hi!
First of all, your script works for me, thanks a lot for that!.
However, as soon as I try to adapt this to my more specific wishes, I run into problems, namely a http 502 "bad gateway" error.
I'd like to set up my backuppc server to serve multiple other, partially custom services as well, e.g. "service-x","service-y","service-z" in nginx.
Those services are all stored in /srv/nginx/http_root/service{x,y,z}/ and should show up again as
http://server/service-x/
http://server/service-y/
http://server/service-z/
next to
http://server/backuppc/
However, as stated, backuppc throws a 502 bad gateway error.
I also tried reverse proxying using proxy_pass, however didn't succeed.
Can you help me?
To join this with your backuppc configuration I created something like
server {
listen 80;
server_name localhost;
root /srv/nginx/http_root;
location / {
index index.php;
}
location /index.cgi {
rewrite ^ http://$server_name/backuppc/$request_uri? permanent;
}
location /backuppc {
auth_basic "BackupPC admin";
auth_basic_user_file /etc/backuppc/htpasswd;
alias /usr/share/backuppc/cgi-bin/;
index /index.cgi;
}
location ~.cgi$ {
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_index BackupPC_Admin;
fastcgi_param SCRIPT_FILENAME /usr/share/backuppc/cgi-bin$fastcgi_script_name;
}
#restrict access to dokuwiki data directories
location ~ ^/dokuwiki/(data|conf|bin|inc)/ {
deny all;
}
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /dmtc/hst_srv/nginx/http_root/$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.