pgAdmin本身并不直接支持多用户访问,但可以通过配置Nginx或Apache等Web服务器来实现多用户访问。以下是具体步骤:
sudo apt update sudo apt install pgadmin4 sudo systemctl start postgresql sudo systemctl enable postgresql CREATE USER myuser WITH PASSWORD 'mypassword'; sudo apt install nginx sudo nano /etc/nginx/sites-available/pgadmin4 server { listen 80; server_name your_domain_or_ip; location / { proxy_pass http://localhost:5050; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } sudo ln -s /etc/nginx/sites-available/pgadmin4 /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl restart nginx sudo apt install apache2 sudo a2enmod proxy sudo a2enmod proxy_http sudo systemctl restart apache2 sudo nano /etc/apache2/sites-available/pgadmin4.conf <VirtualHost *:80> ServerName your_domain_or_ip ProxyPass / http://localhost:5050/ ProxyPassReverse / http://localhost:5050/ </VirtualHost> sudo a2ensite pgadmin4.conf sudo systemctl restart apache2 确保你的防火墙允许HTTP(端口80)和HTTPS(端口443)流量。例如,在基于Debian的系统上,可以使用以下命令:
sudo ufw allow 'Nginx Full' 通过以上步骤,你可以在Debian系统上配置pgAdmin以实现多用户访问。每个用户都需要有自己的pgAdmin账户,并通过各自的账户登录pgAdmin来访问和管理数据库。