Improve build process and fix some nginx configurations