dave110022
dave110022

Reputation: 74

How to preserve folders on server when deploying war file

I am developing an application using Tomcat. I deploy by copying in a war file and restarting the tomcat serice. However, I have large folders full of images and other ancillary data. My question is: is there an alternative to including all the data in the war file for deployment? Specifically: 1) Can folders in the app folder be "protected" during deployment of a war file so they will not be deleted? 2) Would it be bad practice to upload amended classes and jsp files piecemeal to the app folder rather than re-deploy a whole .war file each time? If it is bad practice, why?

Upvotes: 0

Views: 311

Answers (1)

dave110022
dave110022

Reputation: 74

I solved this as follows: store data outside the document root in a folder with the right permissions, then use the "alias" statement in the web server config file.

In my case I am using nginx and my location statement is:

    location /MyApp/data{alias /opt/myapp/data;}

Then I can refer to /data within the app.

Upvotes: 1

Related Questions