Configure GEOSERVER_DATA_DIRECTORY to point to an external folder.¶
The data directory where GeoServer stores the its data is configured by default to a folder within the installation webapps folder. For a production server, you must define a different folder located outside of that, in a different location within your file system.
The data directory is defined using an context parameters named GEOSERVER_DATA_DIRECTORY. Follow this steps to add it.
-
Open the Tomcat
conf/Catalina/localhostfolder, and create or edit thegeoserver.xmlfile. -
Define the
GEOSERVER_DATA_DIRparameter (replace/var/opt/geoserver/datawith your data folder path):<Context> <Parameter name="GEOSERVER_DATA_DIR" value="/var/opt/geoserver/data" override="false"/> </Context>Warning
Hand editing the
WEB-INF/web.xmlfile is ill-advised: it is replaced when GeoServer is upgraded, losing your settings. -
Restart your GeoServer instance for the new configuration to take effect.