-
Notifications
You must be signed in to change notification settings - Fork 0
/
grenerconf.py
40 lines (30 loc) · 941 Bytes
/
grenerconf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-
import os
def getfile(path,fname):
with open(path+fname,"w") as f:
with open("nginx.tpl","r") as tpl:
ret=tpl.readlines()
ret=''.join(ret)
print(ret.format(port="80",servername="www.ben.com",
access_log="ben.log",
home="/ben",
proxy_port=8080))
ret=ret.format(port="80",servername="www.ben.com",
access_log="ben.log",
home="/ben",
proxy_port=8080)
f.write(ret)
if __name__ == '__main__':
getfile(".","test.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};
}}
}}
'''