You can connect to the Postgres database from the web server by setting the DB_HOST to the IP address of the database server. You will also need to make sure that the Postgres server is configured to accept connections from the web server.
To do this, you will need to edit the pg_hba.conf file on the database server. This file is usually located in the data directory of the Postgres installation.
Add the following line to the pg_hba.conf file:
host all all <web_server_ip_address>/32 md5
This will allow the web server to connect to the Postgres server using the username and password specified in the .env file.
Once you have done this, restart the Postgres server and you should be able to connect to the database from the web server.