+1

reverse proxy

Andrew Meyer 7 years ago updated by Suuria 7 years ago 1

Has anyone gotten this to work with nginx using a reverse proxy?

Which one do you need?


for 2.

you have to set inside of teampass your "TeamPass location (URL)" to YOUREXTERNALDOMAIN


Server

1. Server ------------ 2. Proxy ---------------- Client
(nginx+php-fpm) (nginx+SSL termination)

1

server {
    listen          80;
    server_name     YOURINTERNALDOMAIN;

    error_log       /var/log/nginx/teampass_error.log;
    access_log      /var/log/nginx/teampass_access.log;

    root            YOUR_PATH_TO_TEAMPASS;

    client_max_body_size 25M;

    location ~ .php/ {
        rewrite ^(.*.php)/ $1 last;
    }

    location / {
        index index.php;
    }

    location ~ .php$ { ## Execute PHP scripts
        if (!-e $request_filename) { rewrite / /index.php last; }
        expires        off;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_read_timeout 500;
        include        fastcgi_params;    
    }
}

2

server {       
        listen 443 ssl;
        server_name YOUREXTERNALDOMAIN;

        access_log /var/log/nginx/teampass-proxy.access.log;
        
        client_max_body_size 25M;
        
        ssl_certificate PATH_TO_YOUR_CERT;
        ssl_certificate_key PATH_TO_YOUR_KEY;

        location / {
                proxy_set_header        Host $http_host;
                proxy_set_header        X-Real-IP  $remote_addr;
                proxy_set_header        X-Host $host;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass              http://YOURINTERNALDOMAIN;
                proxy_redirect          default;
        }
}