@enoch85 (and @fossxplorer ?) did a great job by writing down a tutorial how to run ownCloud behind a nginx reverse proxy here:
Based on that article a shell script to setup everything is also available by @enoch85 at:
https://github.com/enoch85/scripts/blob/master/techandme/nginx/new_reverse_proxy_host.sh