You need to increase the max_connections settings in postgresql.conf according to this guide:
https://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server
Normally you need to change: max_connections, shared_buffers and work_mem settings
but read it carefully for your environment, also I suggest you to use a connection pooling like pgbouncer according to this guide
https://wiki.postgresql.org/wiki/Number_Of_Database_Connections
Use the connection pooling to reach your number of max_connections instead of config postgresql to that insane value, read more about that here: http://www.cybertec.at/2014/03/max_connections-performance-impacts/
This are just a few tips, hope this helps