This question already has an answer here:
I am using nginx and would like all http traffic to become https using nginx. can someone post an example for nginx config file?
Here is mine. it's not working and i don't have a lot of nginx exprience: https://github.com/oren/wiki/blob/master/dokuwiki.conf