PostGIS - GeoServer 2.18.x User Manual
As with all formats, adding a shapefile to GeoServer involves adding a new store to the existing through the Web administration interface . To begin, navigate to . Fill in the Basic Store Info used to identify the database when managing layers. Move on to the connection parameters used to connect and interact with the database.
https://docs.geoserver.org/stable/en/user/data/database/postgis.html#spatial-indexing