How do I include nginx and gunicorn configuration files in source control on Digital Ocean?

时间秒杀一切 提交于 2019-12-22 11:16:43

问题


I'm running gunicorn and nginx on a Digital Ocean droplet. The issue I'm facing is that my config files for these services are at

/etc/nginx/sites-enabled/django

and

/etc/init/gunicorn.conf

while my code is at /src/my_project

My issue is, my source code is under source control. The config files within /etc/ aren't. This question, How do you deal with configuration files in source control?, says you should keep your config files in source control, but it doesn't explain how to configure them.

How do I include my nginx and gunicorn config files in source control with the rest of my django project, while still keeping the config files attached to nginx and gunicorn appropriately on the server? Thanks!


回答1:


You can add your nginx config file to your repository

mv /etc/nginx/sites-available/django /src/my_project/nginx/django
git add /src/my_project/nginx/django

Then create a symlink.

ln -s /src/my_project/nginx/django /etc/nginx/sites-enabled/django

You can do the same for your gunicorn config.



来源:https://stackoverflow.com/questions/29371563/how-do-i-include-nginx-and-gunicorn-configuration-files-in-source-control-on-dig

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!