apache2pgadmin-4

pgAdmin 4 server mode port


following this tutorial, I've successfully installed pgAdmin4 in server mode. However, pgAdmin4 is accessible by my IP address on the default port. I would like access using another port like the 8081. I've tried by modifying the content of /etc/apache2/sites-available/pgadmin4.conf but without success. Thanks in advance

<VirtualHost *:8081>
ServerName my_ip

WSGIDaemonProcess pgadmin processes=1 threads=25 python-home=/home/user/environments/my_env
WSGIScriptAlias / /home/user/environments/my_env/lib/python3.6/site-packages/pgadmin4/pgAdmin4.wsgi

<Directory "/home/user/environments/my_env/lib/python3.6/site-packages/pgadmin4/">
    WSGIProcessGroup pgadmin
    WSGIApplicationGroup %{GLOBAL}
    Require all granted
</Directory>

Solution

  • I've found the solution myself.

    The steps are:

    1. Configure Apache to Listen on each of the ports you want to service. Add Listen 8081 in the ports.conf file. sudo nano /etc/apache2/ports.conf
    2. Modify the content of pgadmin4.conf as follow sudo nano /etc/apache2/sites-available/pgadmin4.conf

    Type

    <VirtualHost my_ip:8081>
    ServerName my_ip:8081
    
    WSGIDaemonProcess pgadmin processes=1 threads=25 python-home=/home/user/environments/my_env
    WSGIScriptAlias / /home/user/environments/my_env/lib/python3.6/site-packages/pgadmin4/pgAdmin4.wsgi
    
    <Directory "/home/user/environments/my_env/lib/python3.6/site-packages/pgadmin4/">
        WSGIProcessGroup pgadmin
        WSGIApplicationGroup %{GLOBAL}
        Require all granted
    </Directory>
    
    1. Restart apache