Added ssl certificate for nginx and did some refactoring