Closed Nachtexpress closed 11 years ago
Hi, I'll try to manage that on weekend
Thank you very much!
Hi, Nachtexpress despite I had no chance to get to my home workstation these weekend, I suggest you to try this single for all instances config.
server {
listen 80;
server_name localhost;
root /srv/nginx/http_root/;
/* auth is common for all services */
auth_basic "BackupPC admin";
auth_basic_user_file /etc/backuppc/htpasswd;
location /service-x {
/* logs are unique for each service */
access_log /var/log/nginx/service-x.access_log;
error_log /var/log/nginx/service-x.error_log;
alias /service-x/cgi-bin/;
index /index.cgi;
}
location /service-y {
access_log /var/log/nginx/service-y.access_log;
error_log /var/log/nginx/service-y.error_log;
alias /service-y/cgi-bin/;
index /index.cgi;
}
location / {
access_log /var/log/nginx/backuppc.access_log;
error_log /var/log/nginx/backuppc.error_log;
alias /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 /srv/nginx/http_root/cgi-bin$fastcgi_script_name;
}
}
Hi!
I didn't manage to get it to work using your config, but it helped me understand my problem better and I managed to get it working.
The following config is for anybody with the same wished configuration:
nginx serves all contents in /srv/nginx/http_root/* recursively on http://localhost/*, and backuppc is linked in to http://localhost/backuppc (although not placed within the http_root)
First of all, create the new directory http_root/backuppc and place a symbolic link to the backuppc CGI script, so the directory structure looks like this:
/http_root# ls backuppc dokuwiki index.php phpvirtualbox
/http_root# ls -l backuppc/ lrwxrwxrwx 1 root root 35 Jun 20 13:48 backuppc/index.cgi -> /usr/lib/backuppc/cgi-bin/index.cgi
The following works to serve this use-case:
server {
listen 80;
server_name localhost; # auf welche per DNS verlinkten domains soll in dieser Konfig geantwortet werden?
root /srv/nginx/http_root;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log notice;
#later: common auth for all services
#auth_basic "BackupPC admin";
#auth_basic_user_file /etc/backuppc/htpasswd;
location / {
index index.php index.html index.htm;
}
location /backuppc {
auth_basic "BackupPC admin";
auth_basic_user_file /etc/backuppc/htpasswd;
alias /usr/share/backuppc/cgi-bin/;
index /backuppc/index.cgi;
access_log /var/log/nginx/backuppc-access.log;
error_log /var/log/nginx/backuppc-error.log notice;
}
location /backuppc/index.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;
access_log /var/log/nginx/backuppc-access.log;
error_log /var/log/nginx/backuppc-error.log notice;
}
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 /srv/nginx/http_root/$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
}
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 /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; }
}