Skip to content

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.

  1. Open the Tomcat conf/Catalina/localhost folder, and create or edit the geoserver.xml file.

  2. Define the GEOSERVER_DATA_DIR parameter (replace /var/opt/geoserver/data with 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.xml file is ill-advised: it is replaced when GeoServer is upgraded, losing your settings.

  3. Restart your GeoServer instance for the new configuration to take effect.