通过python生成nginx模板配置文件

# cat config.py 
#coding=utf-8
nginx_conf = '''
server {{
    listen       {port};
    server_name  {servername};

    access_log  {access_log}  main;

    location / {{
        root   {home};
        index  index.html index.htm;
        proxy_pass http://127.0.0.1:{proxy_port};
    }}
}}
'''.format(port='8080', servername='cmdb', access_log='/var/log/nginx/cmdb.log',home='/data/python/cmdb/',proxy_port='9999')

handle = open('cmdb.conf','w')
handle.write(nginx_conf)
handle.close()

 

相关文章:

  • 2021-06-15
  • 2022-12-23
  • 2021-06-13
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2022-02-09
  • 2021-09-25
猜你喜欢
  • 2021-07-06
  • 2021-06-06
  • 2022-12-23
  • 2022-12-23
  • 2021-10-18
  • 2021-07-22
  • 2021-11-24
相关资源
相似解决方案