fix and improve nginx setup