add nginx.conf and some refactoring