I haven't actually done this, but I believe you can do what you want by using a combination of calibre and calibre2opds.
First create a calibre database with all your public domain titles, then use calibre2opds to generate the HTML for the website, based on the calibre database.
You can read more about calibre2opds here: https://wiki.mobileread.com/wiki/Calibre2opds
and here: http://calibre2opds.com/
And just in case you're unfamiliar with calibre, you can get it here: http://calibre-ebook.com/