Supervisor配置管理Python项目

supervisord.conf

hightlight:true
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
41
42
43
44
45
46
47
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
chmod=0700 ; socket file mode (default 0700)

[inet_http_server] ; inet (TCP) server disabled by default
port=*:8001
username=your_username ; (default is no username (open server))
password=your_password ; (default is no password (open server))

[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
environment=MONGO_URL="mongodb://reminder:geN-aud-veff@127.0.0.1:27017/reminder"

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket

[program:program_name]
directory=/program_dir
command=uwsgi -w program_name_product --ini program_name.ini --uid role
startsecs=2
numproces=2
stopasgroup=true
autostart=false
autorestart=true
stderr_logfile=/tmp/log/program_name_error.log
stdout_logfile=/tmp/log/program_name_access.log

[program:program_name_n]
directory=/program_n_dir
command=command_n
startsecs=2
numproces=2
stopasgroup=true
autostart=false
autorestart=true
stderr_logfile=/tmp/log/program_name_n_error.log
stdout_logfile=/tmp/log/program_name_n_access.log

进程管理控制台常用命令

hightlight:true
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- supervisorctl # 进入控制台

- start all # 启动配置文件中的所有进程
- stop all # 停止配置文件中的所有进程
- restart all # 重启配置文件中的所有进程

- start program_name # 启动进程
- stop program_name # 停止进程
- restart program_name # 重启进程

- start groupworker: # 启动所有属于名为 groupworker 这个分组的进程
- stop groupworker: # 结束所有属于名为 groupworker 这个分组的进程
- restart groupworker: # 重启所有属于名为 groupworker 这个分组的进程

- start groupworker:name1 # 启动 groupworker:name1 这个进程
- stop groupworker:name1 # 结束 groupworker:name1 这个进程
- restart groupworker:name1 # 重启 groupworker:name1 这个进程

- reload # 载入最新的配置文件,停止原有进程并按新的配置启动、管理所有进程

- update # 根据最新的配置文件,启动新配置或有改动的进程,配置没有改动的进程不会受影响而重启遇到问题
注:start、restartUnlinking stale socket /tmp/supervisor.sock、stop 都不会载入最新的配置文件

- exit # 退出supervisor控制台

Nginx+uWSGI部署多个Django项目

uWSGI配置

project_1 的 uWSGI 的配置文件 project_1.ini

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[uwsgi]

chdir = /project_1/

module = project_1.wsgi

master = true

processes = 10

socket = /project_1/project_1.sock

chmod-socket = 666
chown-socket = role_1:role_1

enable-threads=true

die-on-term = true

project_n 的 uWSGI 的配置文件 project_n.ini

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[uwsgi]

chdir = /project_n/

module = project_n.wsgi

master = true

processes = 10

socket = /project_n/project_n.sock

chmod-socket = 666
chown-socket = role_n:role_n

enable-threads=true

die-on-term = true

Nginx配置

nginx.conf

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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
server {
listen 80;

root /usr/share/nginx/www/public;
index index.php index.html index.htm;

server_name 127.0.0.1 x.x.x.x;
include blocksip.conf;
location / {
try_files $uri $uri/ /index.html;
}

error_page 404 /404.html;

location /project_1 {
include uwsgi_params; # the uwsgi_params file you installed
uwsgi_pass unix:/project_1/project_1.sock;
uwsgi_param SCRIPT_NAME /project_1;
uwsgi_param UWSGI_SCRIPT project_1.wsgi;
uwsgi_modifier1 30;
uwsgi_read_timeout 1800s;
uwsgi_send_timeout 1800s;
}

location /project_1/media/ {
alias /usr/share/nginx/www/django_static/project_1/media/;
}

location /project_1/static/ {
alias /usr/share/nginx/www/django_static/project_1/;
}

location /apk/ {
alias /usr/share/nginx/www/django_static/project_1/apk/online/;
}

location /project_n {
include uwsgi_params; # the uwsgi_params file you installed
uwsgi_pass unix:/project_n/project_n.sock;
uwsgi_param SCRIPT_NAME /project_n;
uwsgi_param UWSGI_SCRIPT project_n.wsgi;
uwsgi_modifier1 30;
uwsgi_read_timeout 1800s;
uwsgi_send_timeout 1800s;
}

location /project_n/media/ {
alias /usr/share/nginx/www/django_static/project_n/media/;
}

location /project_n/static/ {
alias /usr/share/nginx/www/django_static/project_n/;
}

location /apk_project_n/ {
alias /usr/share/nginx/www/django_static/project_n/apk/online/;
}
}

uwsgi命令

UWSGI-CORE

1
2
NAME
- uwsgi-core - fast (pure C), self-healing, developer-friendly WSGI server

User Commands

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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
-s|--socket
bind to the specified UNIX/TCP socket using default protocol
指定socket,使用默认协议

-s|--uwsgi-socket
bind to the specified UNIX/TCP socket using uwsgi protocol
指定socket,使用uwsgi协议

--suwsgi-socket
bind to the specified UNIX/TCP socket using uwsgi protocol over SSL
指定socket,使用uwsgi绑定通过SSL安全套接字层

--ssl-socket
bind to the specified UNIX/TCP socket using uwsgi protocol over SSL
指定socket,使用uwsgi协议通过SSL安全套接字层

--http-socket
bind to the specified UNIX/TCP socket using HTTP protocol
指定socket,使用HTTP协议

--http-socket-modifier1
force the specified modifier1 when using HTTP protocol

--http-socket-modifier2
force the specified modifier2 when using HTTP protocol

--https-socket
bind to the specified UNIX/TCP socket using HTTPS protocol

--https-socket-modifier1
force the specified modifier1 when using HTTPS protocol

--https-socket-modifier2
force the specified modifier2 when using HTTPS protocol

--fastcgi-socket
bind to the specified UNIX/TCP socket using FastCGI protocol

--fastcgi-nph-socket
bind to the specified UNIX/TCP socket using FastCGI protocol (nph mode)

--fastcgi-modifier1
force the specified modifier1 when using FastCGI protocol

--fastcgi-modifier2
force the specified modifier2 when using FastCGI protocol

--scgi-socket
bind to the specified UNIX/TCP socket using SCGI protocol

--scgi-nph-socket
bind to the specified UNIX/TCP socket using SCGI protocol (nph mode)

--scgi-modifier1
force the specified modifier1 when using SCGI protocol

--scgi-modifier2
force the specified modifier2 when using SCGI protocol

--raw-socket
bind to the specified UNIX/TCP socket using RAW protocol

--raw-modifier1
force the specified modifier1 when using RAW protocol

--raw-modifier2
force the specified modifier2 when using RAW protocol

--puwsgi-socket
bind to the specified UNIX/TCP socket using persistent uwsgi protocol (puwsgi)

--protocol
force the specified protocol for default sockets

--socket-protocol
force the specified protocol for default sockets

--shared-socket
create a shared socket for advanced jailing or ipc

--undeferred-shared-socket
create a shared socket for advanced jailing or ipc (undeferred mode)

-p|--processes
spawn the specified number of workers/processes

-p|--workers
spawn the specified number of workers/processes

--thunder-lock
serialize accept() usage (if possible)

-t|--harakiri
set harakiri timeout

--harakiri-verbose
enable verbose mode for harakiri

--harakiri-no-arh
do not enable harakiri during after-request-hook

--no-harakiri-arh
do not enable harakiri during after-request-hook

--no-harakiri-after-req-hook
do not enable harakiri during after-request-hook

--backtrace-depth
set backtrace depth

--mule-harakiri
set harakiri timeout for mule tasks

-x|--xmlconfig
load config from xml file

-x|--xml
load config from xml file

--config
load configuration using the pluggable system

--fallback-config
re-exec uwsgi with the specified config when exit code is 1

--strict
enable strict mode (placeholder cannot be used)

--skip-zero
skip check of file descriptor 0

--skip-atexit
skip atexit hooks (ignored by the master)

--skip-atexit-teardown
skip atexit teardown (ignored by the master)

-S|--set
set a placeholder or an option

--set-placeholder
set a placeholder

--set-ph
set a placeholder

--get print the specified option value and exit

--declare-option
declare a new uWSGI custom option

--declare-option2
declare a new uWSGI custom option (non-immediate)

--resolve
place the result of a dns query in the specified placeholder, sytax: placeholder=name
(immediate option)

--for (opt logic) for cycle

--for-glob
(opt logic) for cycle (expand glob)

--for-times
(opt logic) for cycle (expand the specified num to a list starting from 1)

--for-readline
(opt logic) for cycle (expand the specified file to a list of lines)

--endfor
(opt logic) end for cycle

--end-for
(opt logic) end for cycle

--if-opt
(opt logic) check for option

--if-not-opt
(opt logic) check for option

--if-env
(opt logic) check for environment variable

--if-not-env
(opt logic) check for environment variable

--ifenv
(opt logic) check for environment variable

--if-reload
(opt logic) check for reload

--if-not-reload
(opt logic) check for reload

--if-hostname
(opt logic) check for hostname

--if-not-hostname
(opt logic) check for hostname

--if-hostname-match
(opt logic) try to match hostname against a regular expression

--if-not-hostname-match
(opt logic) try to match hostname against a regular expression

--if-exists
(opt logic) check for file/directory existence

--if-not-exists
(opt logic) check for file/directory existence

--ifexists
(opt logic) check for file/directory existence

--if-plugin
(opt logic) check for plugin

--if-not-plugin
(opt logic) check for plugin

--ifplugin
(opt logic) check for plugin

--if-file
(opt logic) check for file existance

--if-not-file
(opt logic) check for file existance

--if-dir
(opt logic) check for directory existance

--if-not-dir
(opt logic) check for directory existance

--ifdir
(opt logic) check for directory existance

--if-directory
(opt logic) check for directory existance

--endif
(opt logic) end if

--end-if
(opt logic) end if

--blacklist
set options blacklist context

--end-blacklist
clear options blacklist context

--whitelist
set options whitelist context

--end-whitelist
clear options whitelist context

--ignore-sigpipe
do not report (annoying) SIGPIPE

--ignore-write-errors
do not report (annoying) write()/writev() errors

--write-errors-tolerance
set the maximum number of allowed write errors (default: no tolerance)

--write-errors-exception-only
only raise an exception on write errors giving control to the app itself

--disable-write-exception
disable exception generation on write()/writev()

--inherit
use the specified file as config template

--include
include the specified file as immediate configuration

--inject-before
inject a text file before the config file (advanced templating)

--inject-after
inject a text file after the config file (advanced templating)

-d|--daemonize
daemonize uWSGI

--daemonize2
daemonize uWSGI after app loading

--stop stop an instance

--reload
reload an instance

--pause
pause an instance

--suspend
suspend an instance

--resume
resume an instance

--connect-and-read
connect to a socket and wait for data from it

--extract
fetch/dump any supported address to stdout

-l|--listen
set the socket listen queue size

-v|--max-vars
set the amount of internal iovec/vars structures

--max-apps
set the maximum number of per-worker applications

-b|--buffer-size
set internal buffer size

-m|--memory-report
enable memory report

--profiler
enable the specified profiler

-c|--cgi-mode
force CGI-mode for plugins supporting it

-a|--abstract-socket
force UNIX socket in abstract mode (Linux only)

-C|--chmod-socket
chmod-socket

-C|--chmod
chmod-socket

--chown-socket
chown unix sockets

--umask
set umask

--freebind
put socket in freebind mode

--map-socket
map sockets to specific workers

-T|--enable-threads
enable threads

--no-threads-wait
do not wait for threads cancellation on quit/reload

--auto-procname
automatically set processes name to something meaningful

--procname-prefix
add a prefix to the process names

--procname-prefix-spaced
add a spaced prefix to the process names

--procname-append
append a string to process names

--procname
set process names

--procname-master
set master process name

-i|--single-interpreter
do not use multiple interpreters (where available)

--need-app
exit if no app can be loaded

-M|--master
enable master process

--honour-stdin
do not remap stdin to /dev/null

--emperor
run the Emperor

--emperor-proxy-socket
force the vassal to became an Emperor proxy

--emperor-wrapper
set a binary wrapper for vassals

--emperor-wrapper-override
set a binary wrapper for vassals to try before the default one

--emperor-wrapper-fallback
set a binary wrapper for vassals to try as a last resort

--emperor-nofollow
do not follow symlinks when checking for mtime

--emperor-procname
set the Emperor process name

--emperor-freq
set the Emperor scan frequency (default 3 seconds)

--emperor-required-heartbeat
set the Emperor tolerance about heartbeats

--emperor-curse-tolerance
set the Emperor tolerance about cursed vassals

--emperor-pidfile
write the Emperor pid in the specified file

--emperor-tyrant
put the Emperor in Tyrant mode

--emperor-tyrant-nofollow
do not follow symlinks when checking for uid/gid in Tyrant mode

--emperor-stats
run the Emperor stats server

--emperor-stats-server
run the Emperor stats server

--early-emperor
spawn the emperor as soon as possibile

--emperor-broodlord
run the emperor in BroodLord mode

--emperor-throttle
set throttling level (in milliseconds) for bad behaving vassals (default 1000)

--emperor-max-throttle
set max throttling level (in milliseconds) for bad behaving vassals (default 3 minutes)

--emperor-magic-exec
prefix vassals config files with exec:// if they have the executable bit

--emperor-on-demand-extension
search for text file (vassal name + extension) containing the on demand socket name

--emperor-on-demand-ext
search for text file (vassal name + extension) containing the on demand socket name

--emperor-on-demand-directory
enable on demand mode binding to the unix socket in the specified directory named like
the vassal + .socket

--emperor-on-demand-dir
enable on demand mode binding to the unix socket in the specified directory named like
the vassal + .socket

--emperor-on-demand-exec
use the output of the specified command as on demand socket name (the vassal name is
passed as the only argument)

--emperor-extra-extension
allows the specified extension in the Emperor (vassal will be called with --config)

--emperor-extra-ext
allows the specified extension in the Emperor (vassal will be called with --config)

--emperor-no-blacklist
disable Emperor blacklisting subsystem

--emperor-use-clone
use clone() instead of fork() passing the specified unshare() flags

--emperor-cap
set vassals capability

--vassals-cap
set vassals capability

--vassal-cap
set vassals capability

--imperial-monitor-list
list enabled imperial monitors

--imperial-monitors-list
list enabled imperial monitors

--vassals-inherit
add config templates to vassals config (uses --inherit)

--vassals-include
include config templates to vassals config (uses --include instead of --inherit)

--vassals-inherit-before
add config templates to vassals config (uses --inherit, parses before the vassal file)

--vassals-include-before
include config templates to vassals config (uses --include instead of --inherit, parses
before the vassal file)

--vassals-start-hook
run the specified command before each vassal starts

--vassals-stop-hook
run the specified command after vassal's death

--vassal-sos
ask emperor for reinforcement when overloaded

--vassal-sos-backlog
ask emperor for sos if backlog queue has more items than the value specified

--vassals-set
automatically set the specified option (via --set) for every vassal

--vassal-set
automatically set the specified option (via --set) for every vassal

--heartbeat
announce healthiness to the emperor

--reload-mercy
set the maximum time (in seconds) we wait for workers and other processes to die during
reload/shutdown

--worker-reload-mercy
set the maximum time (in seconds) a worker can take to reload/shutdown (default is 60)

--mule-reload-mercy
set the maximum time (in seconds) a mule can take to reload/shutdown (default is 60)

--exit-on-reload
force exit even if a reload is requested

--die-on-term
exit instead of brutal reload on SIGTERM

--force-gateway
force the spawn of the first registered gateway without a master

-h|--help
show this help

-h|--usage
show this help

--print-sym
print content of the specified binary symbol

--print-symbol
print content of the specified binary symbol

-r|--reaper
call waitpid(-1,...) after each request to get rid of zombies

-R|--max-requests
reload workers after the specified amount of managed requests

--min-worker-lifetime
number of seconds worker must run before being reloaded (default is 60)

--max-worker-lifetime
reload workers after the specified amount of seconds (default is disabled)

-z|--socket-timeout
set internal sockets timeout

--no-fd-passing
disable file descriptor passing

--locks
create the specified number of shared locks

--lock-engine
set the lock engine

--ftok set the ipcsem key via ftok() for avoiding duplicates

--persistent-ipcsem
do not remove ipcsem's on shutdown

-A|--sharedarea
create a raw shared memory area of specified pages (note: it supports keyval too)

--safe-fd
do not close the specified file descriptor

--fd-safe
do not close the specified file descriptor

--cache
create a shared cache containing given elements

--cache-blocksize
set cache blocksize

--cache-store
enable persistent cache to disk

--cache-store-sync
set frequency of sync for persistent cache

--cache-no-expire
disable auto sweep of expired items

--cache-expire-freq
set the frequency of cache sweeper scans (default 3 seconds)

--cache-report-freed-items
constantly report the cache item freed by the sweeper (use only for debug)

--cache-udp-server
bind the cache udp server (used only for set/update/delete) to the specified socket

--cache-udp-node
send cache update/deletion to the specified cache udp server

--cache-sync
copy the whole content of another uWSGI cache server on server startup

--cache-use-last-modified
update last_modified_at timestamp on every cache item modification (default is disabled)

--add-cache-item
add an item in the cache

--load-file-in-cache
load a static file in the cache

--load-file-in-cache-gzip
load a static file in the cache with gzip compression

--cache2
create a new generation shared cache (keyval syntax)

--queue
enable shared queue

--queue-blocksize
set queue blocksize

--queue-store
enable persistent queue to disk

--queue-store-sync
set frequency of sync for persistent queue

-Q|--spooler
run a spooler on the specified directory

--spooler-external
map spoolers requests to a spooler directory managed by an external instance

--spooler-ordered
try to order the execution of spooler tasks

--spooler-chdir
chdir() to specified directory before each spooler task

--spooler-processes
set the number of processes for spoolers

--spooler-quiet
do not be verbose with spooler tasks

--spooler-max-tasks
set the maximum number of tasks to run before recycling a spooler

--spooler-harakiri
set harakiri timeout for spooler tasks

--spooler-frequency
set spooler frequency

--spooler-freq
set spooler frequency

--mule add a mule

--mules
add the specified number of mules

--farm add a mule farm

--mule-msg-size
set mule message buffer size

--signal
send a uwsgi signal to a server

--signal-bufsize
set buffer size for signal queue

--signals-bufsize
set buffer size for signal queue

--signal-timer
add a timer (syntax: <signal> <seconds>)

--timer
add a timer (syntax: <signal> <seconds>)

--signal-rbtimer
add a redblack timer (syntax: <signal> <seconds>)

--rbtimer
add a redblack timer (syntax: <signal> <seconds>)

--rpc-max
maximum number of rpc slots (default: 64)

-L|--disable-logging
disable request logging

--flock
lock the specified file before starting, exit if locked

--flock-wait
lock the specified file before starting, wait if locked

--flock2
lock the specified file after logging/daemon setup, exit if locked

--flock-wait2
lock the specified file after logging/daemon setup, wait if locked

--pidfile
create pidfile (before privileges drop)

--pidfile2
create pidfile (after privileges drop)

--chroot
chroot() to the specified directory

--pivot-root
pivot_root() to the specified directories (new_root and put_old must be separated with a
space)

--pivot_root
pivot_root() to the specified directories (new_root and put_old must be separated with a
space)

--uid setuid to the specified user/uid

--gid setgid to the specified group/gid

--add-gid
add the specified group id to the process credentials

--immediate-uid
setuid to the specified user/uid IMMEDIATELY

--immediate-gid
setgid to the specified group/gid IMMEDIATELY

--no-initgroups
disable additional groups set via initgroups()

--cap set process capability

--unshare
unshare() part of the processes and put it in a new namespace

--unshare2
unshare() part of the processes and put it in a new namespace after rootfs change

--setns-socket
expose a unix socket returning namespace fds from /proc/self/ns

--setns-socket-skip
skip the specified entry when sending setns file descriptors

--setns-skip
skip the specified entry when sending setns file descriptors

--setns
join a namespace created by an external uWSGI instance

--setns-preopen
open /proc/self/ns as soon as possible and cache fds

--jailed
mark the instance as jailed (force the execution of post_jail hooks)

--refork
fork() again after privileges drop. Useful for jailing systems

--re-fork
fork() again after privileges drop. Useful for jailing systems

--refork-as-root
fork() again before privileges drop. Useful for jailing systems

--re-fork-as-root
fork() again before privileges drop. Useful for jailing systems

--refork-post-jail
fork() again after jailing. Useful for jailing systems

--re-fork-post-jail
fork() again after jailing. Useful for jailing systems

--hook-asap
run the specified hook as soon as possible

--hook-pre-jail
run the specified hook before jailing

--hook-post-jail
run the specified hook after jailing

--hook-in-jail
run the specified hook in jail after initialization

--hook-as-root
run the specified hook before privileges drop

--hook-as-user
run the specified hook after privileges drop

--hook-as-user-atexit
run the specified hook before app exit and reload

--hook-pre-app
run the specified hook before app loading

--hook-post-app
run the specified hook after app loading

--hook-post-fork
run the specified hook after each fork

--hook-accepting
run the specified hook after each worker enter the accepting phase

--hook-accepting1
run the specified hook after the first worker enters the accepting phase

--hook-accepting-once
run the specified hook after each worker enter the accepting phase (once per-instance)

--hook-accepting1-once
run the specified hook after the first worker enters the accepting phase (once per
instance)

--hook-master-start
run the specified hook when the Master starts

--hook-touch
run the specified hook when the specified file is touched (syntax: <file> <action>)

--hook-emperor-start
run the specified hook when the Emperor starts

--hook-emperor-stop
run the specified hook when the Emperor send a stop message

--hook-emperor-reload
run the specified hook when the Emperor send a reload message

--hook-emperor-lost
run the specified hook when the Emperor connection is lost

--hook-as-vassal
run the specified hook before exec()ing the vassal

--hook-as-emperor
run the specified hook in the emperor after the vassal has been started

--hook-as-mule
run the specified hook in each mule

--hook-as-gateway
run the specified hook in each gateway

--after-request-hook
run the specified function/symbol after each request

--after-request-call
run the specified function/symbol after each request

--exec-asap
run the specified command as soon as possible

--exec-pre-jail
run the specified command before jailing

--exec-post-jail
run the specified command after jailing

--exec-in-jail
run the specified command in jail after initialization

--exec-as-root
run the specified command before privileges drop

--exec-as-user
run the specified command after privileges drop

--exec-as-user-atexit
run the specified command before app exit and reload

--exec-pre-app
run the specified command before app loading

--exec-post-app
run the specified command after app loading

--exec-as-vassal
run the specified command before exec()ing the vassal

--exec-as-emperor
run the specified command in the emperor after the vassal has been started

--mount-asap
mount filesystem as soon as possible

--mount-pre-jail
mount filesystem before jailing

--mount-post-jail
mount filesystem after jailing

--mount-in-jail
mount filesystem in jail after initialization

--mount-as-root
mount filesystem before privileges drop

--mount-as-vassal
mount filesystem before exec()ing the vassal

--mount-as-emperor
mount filesystem in the emperor after the vassal has been started

--umount-asap
unmount filesystem as soon as possible

--umount-pre-jail
unmount filesystem before jailing

--umount-post-jail
unmount filesystem after jailing

--umount-in-jail
unmount filesystem in jail after initialization

--umount-as-root
unmount filesystem before privileges drop

--umount-as-vassal
unmount filesystem before exec()ing the vassal

--umount-as-emperor
unmount filesystem in the emperor after the vassal has been started

--wait-for-interface
wait for the specified network interface to come up before running root hooks

--wait-for-interface-timeout
set the timeout for wait-for-interface

--wait-interface
wait for the specified network interface to come up before running root hooks

--wait-interface-timeout
set the timeout for wait-for-interface

--wait-for-iface
wait for the specified network interface to come up before running root hooks

--wait-for-iface-timeout
set the timeout for wait-for-interface

--wait-iface
wait for the specified network interface to come up before running root hooks

--wait-iface-timeout
set the timeout for wait-for-interface

--wait-for-fs
wait for the specified filesystem item to appear before running root hooks

--wait-for-file
wait for the specified file to appear before running root hooks

--wait-for-dir
wait for the specified directory to appear before running root hooks

--wait-for-mountpoint
wait for the specified mountpoint to appear before running root hooks

--wait-for-fs-timeout
set the timeout for wait-for-fs/file/dir

--wait-for-socket
wait for the specified socket to be ready before loading apps

--wait-for-socket-timeout
set the timeout for wait-for-socket

--call-asap
call the specified function as soon as possible

--call-pre-jail
call the specified function before jailing

--call-post-jail
call the specified function after jailing

--call-in-jail
call the specified function in jail after initialization

--call-as-root
call the specified function before privileges drop

--call-as-user
call the specified function after privileges drop

--call-as-user-atexit
call the specified function before app exit and reload

--call-pre-app
call the specified function before app loading

--call-post-app
call the specified function after app loading

--call-as-vassal
call the specified function() before exec()ing the vassal

--call-as-vassal1
call the specified function(char *) before exec()ing the vassal

--call-as-vassal3
call the specified function(char *, uid_t, gid_t) before exec()ing the vassal

--call-as-emperor
call the specified function() in the emperor after the vassal has been started

--call-as-emperor1
call the specified function(char *) in the emperor after the vassal has been started

--call-as-emperor2
call the specified function(char *, pid_t) in the emperor after the vassal has been
started

--call-as-emperor4
call the specified function(char *, pid_t, uid_t, gid_t) in the emperor after the vassal
has been started

--ini load config from ini file

-y|--yaml
load config from yaml file

-y|--yml
load config from yaml file

-j|--json
load config from json file

-j|--js
load config from json file

--weight
weight of the instance (used by clustering/lb/subscriptions)

--auto-weight
set weight of the instance (used by clustering/lb/subscriptions) automatically

--no-server
force no-server mode

--command-mode
force command mode

--no-defer-accept
disable deferred-accept on sockets

--tcp-nodelay
enable TCP NODELAY on each request

--so-keepalive
enable TCP KEEPALIVEs

--so-send-timeout
set SO_SNDTIMEO

--socket-send-timeout
set SO_SNDTIMEO

--so-write-timeout
set SO_SNDTIMEO

--socket-write-timeout
set SO_SNDTIMEO

--socket-sndbuf
set SO_SNDBUF

--socket-rcvbuf
set SO_RCVBUF

--limit-as
limit processes address space/vsz

--limit-nproc
limit the number of spawnable processes

--reload-on-as
reload if address space is higher than specified megabytes

--reload-on-rss
reload if rss memory is higher than specified megabytes

--evil-reload-on-as
force the master to reload a worker if its address space is higher than specified
megabytes

--evil-reload-on-rss
force the master to reload a worker if its rss memory is higher than specified megabytes

--mem-collector-freq
set the memory collector frequency when evil reloads are in place

--reload-on-fd
reload if the specified file descriptor is ready

--brutal-reload-on-fd
brutal reload if the specified file descriptor is ready

--ksm enable Linux KSM

--pcre-jit
enable pcre jit (if available)

--never-swap
lock all memory pages avoiding swapping

--touch-reload
reload uWSGI if the specified file is modified/touched

--touch-workers-reload
trigger reload of (only) workers if the specified file is modified/touched

--touch-mules-reload
reload mules if the specified file is modified/touched

--touch-spoolers-reload
reload spoolers if the specified file is modified/touched

--touch-chain-reload
trigger chain reload if the specified file is modified/touched

--touch-logrotate
trigger logrotation if the specified file is modified/touched

--touch-logreopen
trigger log reopen if the specified file is modified/touched

--touch-exec
run command when the specified file is modified/touched (syntax: file command)

--touch-signal
signal when the specified file is modified/touched (syntax: file signal)

--fs-reload
graceful reload when the specified filesystem object is modified

--fs-brutal-reload
brutal reload when the specified filesystem object is modified

--fs-signal
raise a uwsgi signal when the specified filesystem object is modified (syntax: file sig‐
nal)

--check-mountpoint
destroy the instance if a filesystem is no more reachable (useful for reliable Fuse man‐
agement)

--mountpoint-check
destroy the instance if a filesystem is no more reachable (useful for reliable Fuse man‐
agement)

--check-mount
destroy the instance if a filesystem is no more reachable (useful for reliable Fuse man‐
agement)

--mount-check
destroy the instance if a filesystem is no more reachable (useful for reliable Fuse man‐
agement)

--propagate-touch
over-engineering option for system with flaky signal management

--limit-post
limit request body

--no-orphans
automatically kill workers if master dies (can be dangerous for availability)

--prio set processes/threads priority

--cpu-affinity
set cpu affinity

--post-buffering
set size in bytes after which will buffer to disk instead of memory

--post-buffering-bufsize
set buffer size for read() in post buffering mode

--body-read-warning
set the amount of allowed memory allocation (in megabytes) for request body before start‐
ing printing a warning

--upload-progress
enable creation of .json files in the specified directory during a file upload

--no-default-app
do not fallback to default app

--manage-script-name
automatically rewrite SCRIPT_NAME and PATH_INFO

--ignore-script-name
ignore SCRIPT_NAME

--catch-exceptions
report exception as http output (discouraged, use only for testing)

--reload-on-exception
reload a worker when an exception is raised

--reload-on-exception-type
reload a worker when a specific exception type is raised

--reload-on-exception-value
reload a worker when a specific exception value is raised

--reload-on-exception-repr
reload a worker when a specific exception type+value (language-specific) is raised

--exception-handler
add an exception handler

--enable-metrics
enable metrics subsystem

--metric
add a custom metric

--metric-threshold
add a metric threshold/alarm

--metric-alarm
add a metric threshold/alarm

--alarm-metric
add a metric threshold/alarm

--metrics-dir
export metrics as text files to the specified directory

--metrics-dir-restore
restore last value taken from the metrics dir

--metric-dir
export metrics as text files to the specified directory

--metric-dir-restore
restore last value taken from the metrics dir

--metrics-no-cores
disable generation of cores-related metrics

--udp run the udp server on the specified address

--stats
enable the stats server on the specified address

--stats-server
enable the stats server on the specified address

--stats-http
prefix stats server json output with http headers

--stats-minified
minify statistics json output

--stats-min
minify statistics json output

--stats-push
push the stats json to the specified destination

--stats-pusher-default-freq
set the default frequency of stats pushers

--stats-pushers-default-freq
set the default frequency of stats pushers

--stats-no-cores
disable generation of cores-related stats

--stats-no-metrics
do not include metrics in stats output

--multicast
subscribe to specified multicast group

--multicast-ttl
set multicast ttl

--multicast-loop
set multicast loop (default 1)

--master-fifo
enable the master fifo

--notify-socket
enable the notification socket

--subscription-notify-socket
set the notification socket for subscriptions

--legion
became a member of a legion

--legion-mcast
became a member of a legion (shortcut for multicast)

--legion-node
add a node to a legion

--legion-freq
set the frequency of legion packets

--legion-tolerance
set the tolerance of legion subsystem

--legion-death-on-lord-error
declare itself as a dead node for the specified amount of seconds if one of the lord
hooks fails

--legion-skew-tolerance
set the clock skew tolerance of legion subsystem (default 30 seconds)

--legion-lord
action to call on Lord election

--legion-unlord
action to call on Lord dismiss

--legion-setup
action to call on legion setup

--legion-death
action to call on legion death (shutdown of the instance)

--legion-join
action to call on legion join (first time quorum is reached)

--legion-node-joined
action to call on new node joining legion

--legion-node-left
action to call node leaving legion

--legion-quorum
set the quorum of a legion

--legion-scroll
set the scroll of a legion

--legion-scroll-max-size
set max size of legion scroll buffer

--legion-scroll-list-max-size
set max size of legion scroll list buffer

--subscriptions-sign-check
set digest algorithm and certificate directory for secured subscription system

--subscriptions-sign-check-tolerance
set the maximum tolerance (in seconds) of clock skew for secured subscription system

--subscriptions-sign-skip-uid
skip signature check for the specified uid when using unix sockets credentials

--subscriptions-credentials-check
add a directory to search for subscriptions key credentials

--subscriptions-use-credentials
enable management of SCM_CREDENTIALS in subscriptions UNIX sockets

--subscription-algo
set load balancing algorithm for the subscription system

--subscription-dotsplit
try to fallback to the next part (dot based) in subscription key

--subscribe-to
subscribe to the specified subscription server

--st subscribe to the specified subscription server

--subscribe
subscribe to the specified subscription server

--subscribe2
subscribe to the specified subscription server using advanced keyval syntax

--subscribe-freq
send subscription announce at the specified interval

--subscription-tolerance
set tolerance for subscription servers

--unsubscribe-on-graceful-reload
force unsubscribe request even during graceful reload

--start-unsubscribed
configure subscriptions but do not send them (useful with master fifo)

--subscribe-with-modifier1
force the specififed modifier1 when subscribing

--snmp enable the embedded snmp server

--snmp-community
set the snmp community string

--ssl-verbose
be verbose about SSL errors

--sni add an SNI-governed SSL context

--sni-dir
check for cert/key/client_ca file in the specified directory and create a sni/ssl context
on demand

--sni-dir-ciphers
set ssl ciphers for sni-dir option

--ssl-enable3
enable SSLv3 (insecure)

--ssl-option
set a raw ssl option (numeric value)

--sni-regexp
add an SNI-governed SSL context (the key is a regexp)

--ssl-tmp-dir
store ssl-related temp files in the specified directory

--check-interval
set the interval (in seconds) of master checks

--forkbomb-delay
sleep for the specified number of seconds when a forkbomb is detected

--binary-path
force binary path

--privileged-binary-patch
patch the uwsgi binary with a new command (before privileges drop)

--unprivileged-binary-patch
patch the uwsgi binary with a new command (after privileges drop)

--privileged-binary-patch-arg
patch the uwsgi binary with a new command and arguments (before privileges drop)

--unprivileged-binary-patch-arg
patch the uwsgi binary with a new command and arguments (after privileges drop)

--async
enable async mode with specified cores

--max-fd
set maximum number of file descriptors (requires root privileges)

--logto
set logfile/udp address

--logto2
log to specified file or udp address after privileges drop

--log-format
set advanced format for request logging

--logformat
set advanced format for request logging

--logformat-strftime
apply strftime to logformat output

--log-format-strftime
apply strftime to logformat output

--logfile-chown
chown logfiles

--logfile-chmod
chmod logfiles

--log-syslog
log to syslog

--log-socket
send logs to the specified socket

--req-logger
set/append a request logger

--logger-req
set/append a request logger

--logger
set/append a logger

--logger-list
list enabled loggers

--loggers-list
list enabled loggers

--threaded-logger
offload log writing to a thread

--log-encoder
add an item in the log encoder chain

--log-req-encoder
add an item in the log req encoder chain

--log-drain
drain (do not show) log lines matching the specified regexp

--log-filter
show only log lines matching the specified regexp

--log-route
log to the specified named logger if regexp applied on logline matches

--log-req-route
log requests to the specified named logger if regexp applied on logline matches

--use-abort
call abort() on segfault/fpe, could be useful for generating a core dump

--alarm
create a new alarm, syntax: <alarm> <plugin:args>

--alarm-cheap
use main alarm thread rather than create dedicated threads for curl-based alarms

--alarm-freq
tune the anti-loop alarm system (default 3 seconds)

--alarm-fd
raise the specified alarm when an fd is read for read (by default it reads 1 byte, set 8
for eventfd)

--alarm-segfault
raise the specified alarm when the segmentation fault handler is executed

--segfault-alarm
raise the specified alarm when the segmentation fault handler is executed

--alarm-backlog
raise the specified alarm when the socket backlog queue is full

--backlog-alarm
raise the specified alarm when the socket backlog queue is full

--lq-alarm
raise the specified alarm when the socket backlog queue is full

--alarm-lq
raise the specified alarm when the socket backlog queue is full

--alarm-listen-queue
raise the specified alarm when the socket backlog queue is full

--listen-queue-alarm
raise the specified alarm when the socket backlog queue is full

--log-alarm
raise the specified alarm when a log line matches the specified regexp, syntax:
<alarm>[,alarm...] <regexp>

--alarm-log
raise the specified alarm when a log line matches the specified regexp, syntax:
<alarm>[,alarm...] <regexp>

--not-log-alarm
skip the specified alarm when a log line matches the specified regexp, syntax:
<alarm>[,alarm...] <regexp>

--not-alarm-log
skip the specified alarm when a log line matches the specified regexp, syntax:
<alarm>[,alarm...] <regexp>

--alarm-list
list enabled alarms

--alarms-list
list enabled alarms

--alarm-msg-size
set the max size of an alarm message (default 8192)

--log-master
delegate logging to master process

--log-master-bufsize
set the buffer size for the master logger. bigger log messages will be truncated

--log-master-stream
create the master logpipe as SOCK_STREAM

--log-master-req-stream
create the master requests logpipe as SOCK_STREAM

--log-reopen
reopen log after reload

--log-truncate
truncate log on startup

--log-maxsize
set maximum logfile size

--log-backupname
set logfile name after rotation

--logdate
prefix logs with date or a strftime string

--log-date
prefix logs with date or a strftime string

--log-prefix
prefix logs with a string

--log-zero
log responses without body

--log-slow
log requests slower than the specified number of milliseconds

--log-4xx
log requests with a 4xx response

--log-5xx
log requests with a 5xx response

--log-big
log requestes bigger than the specified size

--log-sendfile
log sendfile requests

--log-ioerror
log requests with io errors

--log-micros
report response time in microseconds instead of milliseconds

--log-x-forwarded-for
use the ip from X-Forwarded-For header instead of REMOTE_ADDR

--master-as-root
leave master process running as root

--drop-after-init
run privileges drop after plugin initialization, superseded by drop-after-apps

--drop-after-apps
run privileges drop after apps loading, superseded by master-as-root

--force-cwd
force the initial working directory to the specified value

--binsh
override /bin/sh (used by exec hooks, it always fallback to /bin/sh)

--chdir
chdir to specified directory before apps loading

--chdir2
chdir to specified directory after apps loading

--lazy set lazy mode (load apps in workers instead of master)

--lazy-apps
load apps in each worker instead of the master

--cheap
set cheap mode (spawn workers only after the first request)

--cheaper
set cheaper mode (adaptive process spawning)

--cheaper-initial
set the initial number of processes to spawn in cheaper mode

--cheaper-algo
choose to algorithm used for adaptive process spawning

--cheaper-step
number of additional processes to spawn at each overload

--cheaper-overload
increase workers after specified overload

--cheaper-algo-list
list enabled cheapers algorithms

--cheaper-algos-list
list enabled cheapers algorithms

--cheaper-list
list enabled cheapers algorithms

--cheaper-rss-limit-soft
don't spawn new workers if total resident memory usage of all workers is higher than this
limit

--cheaper-rss-limit-hard
if total workers resident memory usage is higher try to stop workers

--idle set idle mode (put uWSGI in cheap mode after inactivity)

--die-on-idle
shutdown uWSGI when idle

--mount
load application under mountpoint

--worker-mount
load application under mountpoint in the specified worker or after workers spawn

--threads
run each worker in prethreaded mode with the specified number of threads

--thread-stacksize
set threads stacksize

--threads-stacksize
set threads stacksize

--thread-stack-size
set threads stacksize

--threads-stack-size
set threads stacksize

--vhost
enable virtualhosting mode (based on SERVER_NAME variable)

--vhost-host
enable virtualhosting mode (based on HTTP_HOST variable)

--route
add a route

--route-host
add a route based on Host header

--route-uri
add a route based on REQUEST_URI

--route-qs
add a route based on QUERY_STRING

--route-remote-addr
add a route based on REMOTE_ADDR

--route-user-agent
add a route based on HTTP_USER_AGENT

--route-remote-user
add a route based on REMOTE_USER

--route-referer
add a route based on HTTP_REFERER

--route-label
add a routing label (for use with goto)

--route-if
add a route based on condition

--route-if-not
add a route based on condition (negate version)

--route-run
always run the specified route action

--final-route
add a final route

--final-route-status
add a final route for the specified status

--final-route-host
add a final route based on Host header

--final-route-uri
add a final route based on REQUEST_URI

--final-route-qs
add a final route based on QUERY_STRING

--final-route-remote-addr
add a final route based on REMOTE_ADDR

--final-route-user-agent
add a final route based on HTTP_USER_AGENT

--final-route-remote-user
add a final route based on REMOTE_USER

--final-route-referer
add a final route based on HTTP_REFERER

--final-route-label
add a final routing label (for use with goto)

--final-route-if
add a final route based on condition

--final-route-if-not
add a final route based on condition (negate version)

--final-route-run
always run the specified final route action

--error-route
add an error route

--error-route-status
add an error route for the specified status

--error-route-host
add an error route based on Host header

--error-route-uri
add an error route based on REQUEST_URI

--error-route-qs
add an error route based on QUERY_STRING

--error-route-remote-addr
add an error route based on REMOTE_ADDR

--error-route-user-agent
add an error route based on HTTP_USER_AGENT

--error-route-remote-user
add an error route based on REMOTE_USER

--error-route-referer
add an error route based on HTTP_REFERER

--error-route-label
add an error routing label (for use with goto)

--error-route-if
add an error route based on condition

--error-route-if-not
add an error route based on condition (negate version)

--error-route-run
always run the specified error route action

--response-route
add a response route

--response-route-status
add a response route for the specified status

--response-route-host
add a response route based on Host header

--response-route-uri
add a response route based on REQUEST_URI

--response-route-qs
add a response route based on QUERY_STRING

--response-route-remote-addr
add a response route based on REMOTE_ADDR

--response-route-user-agent
add a response route based on HTTP_USER_AGENT

--response-route-remote-user
add a response route based on REMOTE_USER

--response-route-referer
add a response route based on HTTP_REFERER

--response-route-label
add a response routing label (for use with goto)

--response-route-if
add a response route based on condition

--response-route-if-not
add a response route based on condition (negate version)

--response-route-run
always run the specified response route action

--router-list
list enabled routers

--routers-list
list enabled routers

--error-page-403
add an error page (html) for managed 403 response

--error-page-404
add an error page (html) for managed 404 response

--error-page-500
add an error page (html) for managed 500 response

--websockets-ping-freq
set the frequency (in seconds) of websockets automatic ping packets

--websocket-ping-freq
set the frequency (in seconds) of websockets automatic ping packets

--websockets-pong-tolerance
set the tolerance (in seconds) of websockets ping/pong subsystem

--websocket-pong-tolerance
set the tolerance (in seconds) of websockets ping/pong subsystem

--websockets-max-size
set the max allowed size of websocket messages (in Kbytes, default 1024)

--websocket-max-size
set the max allowed size of websocket messages (in Kbytes, default 1024)

--chunked-input-limit
set the max size of a chunked input part (default 1MB, in bytes)

--chunked-input-timeout
set default timeout for chunked input

--clock
set a clock source

--clock-list
list enabled clocks

--clocks-list
list enabled clocks

--add-header
automatically add HTTP headers to response

--rem-header
automatically remove specified HTTP header from the response

--del-header
automatically remove specified HTTP header from the response

--collect-header
store the specified response header in a request var (syntax: header var)

--response-header-collect
store the specified response header in a request var (syntax: header var)

--pull-header
store the specified response header in a request var and remove it from the response
(syntax: header var)

--check-static
check for static files in the specified directory

--check-static-docroot
check for static files in the requested DOCUMENT_ROOT

--static-check
check for static files in the specified directory

--static-map
map mountpoint to static directory (or file)

--static-map2
like static-map but completely appending the requested resource to the docroot

--static-skip-ext
skip specified extension from staticfile checks

--static-index
search for specified file if a directory is requested

--static-safe
skip security checks if the file is under the specified path

--static-cache-paths
put resolved paths in the uWSGI cache for the specified amount of seconds

--static-cache-paths-name
use the specified cache for static paths

--mimefile
set mime types file path (default /etc/mime.types)

--mime-file
set mime types file path (default /etc/mime.types)

--static-expires-type
set the Expires header based on content type

--static-expires-type-mtime
set the Expires header based on content type and file mtime

--static-expires
set the Expires header based on filename regexp

--static-expires-mtime
set the Expires header based on filename regexp and file mtime

--static-expires-uri
set the Expires header based on REQUEST_URI regexp

--static-expires-uri-mtime
set the Expires header based on REQUEST_URI regexp and file mtime

--static-expires-path-info
set the Expires header based on PATH_INFO regexp

--static-expires-path-info-mtime
set the Expires header based on PATH_INFO regexp and file mtime

--static-gzip
if the supplied regexp matches the static file translation it will search for a gzip ver‐
sion

--static-gzip-all
check for a gzip version of all requested static files

--static-gzip-dir
check for a gzip version of all requested static files in the specified dir/prefix

--static-gzip-prefix
check for a gzip version of all requested static files in the specified dir/prefix

--static-gzip-ext
check for a gzip version of all requested static files with the specified ext/suffix

--static-gzip-suffix
check for a gzip version of all requested static files with the specified ext/suffix

--honour-range
enable support for the HTTP Range header

--offload-threads
set the number of offload threads to spawn (per-worker, default 0)

--offload-thread
set the number of offload threads to spawn (per-worker, default 0)

--file-serve-mode
set static file serving mode

--fileserve-mode
set static file serving mode

--disable-sendfile
disable sendfile() and rely on boring read()/write()

--check-cache
check for response data in the specified cache (empty for default cache)

--close-on-exec
set close-on-exec on connection sockets (could be required for spawning processes in
requests)

--close-on-exec2
set close-on-exec on server sockets (could be required for spawning processes in
requests)

--mode set uWSGI custom mode

--env set environment variable

--envdir
load a daemontools compatible envdir

--early-envdir
load a daemontools compatible envdir ASAP

--unenv
unset environment variable

--vacuum
try to remove all of the generated file/sockets

--file-write
write the specified content to the specified file (syntax: file=value) before privileges
drop

--cgroup
put the processes in the specified cgroup

--cgroup-opt
set value in specified cgroup option

--cgroup-dir-mode
set permission for cgroup directory (default is 700)

--namespace
run in a new namespace under the specified rootfs

--namespace-keep-mount
keep the specified mountpoint in your namespace

--ns run in a new namespace under the specified rootfs

--namespace-net
add network namespace

--ns-net
add network namespace

--enable-proxy-protocol
enable PROXY1 protocol support (only for http parsers)

--reuse-port
enable REUSE_PORT flag on socket (BSD only)

--tcp-fast-open
enable TCP_FASTOPEN flag on TCP sockets with the specified qlen value

--tcp-fastopen
enable TCP_FASTOPEN flag on TCP sockets with the specified qlen value

--tcp-fast-open-client
use sendto(..., MSG_FASTOPEN, ...) instead of connect() if supported

--tcp-fastopen-client
use sendto(..., MSG_FASTOPEN, ...) instead of connect() if supported

--zerg attach to a zerg server

--zerg-fallback
fallback to normal sockets if the zerg server is not available

--zerg-server
enable the zerg server on the specified UNIX socket

--cron add a cron task

--cron2
add a cron task (key=val syntax)

--unique-cron
add a unique cron task

--cron-harakiri
set the maximum time (in seconds) we wait for cron command to complete

--legion-cron
add a cron task runnable only when the instance is a lord of the specified legion

--cron-legion
add a cron task runnable only when the instance is a lord of the specified legion

--unique-legion-cron
add a unique cron task runnable only when the instance is a lord of the specified legion

--unique-cron-legion
add a unique cron task runnable only when the instance is a lord of the specified legion

--loop select the uWSGI loop engine

--loop-list
list enabled loop engines

--loops-list
list enabled loop engines

--worker-exec
run the specified command as worker

--worker-exec2
run the specified command as worker (after post_fork hook)

--attach-daemon
attach a command/daemon to the master process (the command has to not go in background)

--attach-control-daemon
attach a command/daemon to the master process (the command has to not go in background),
when the daemon dies, the master dies too

--smart-attach-daemon
attach a command/daemon to the master process managed by a pidfile (the command has to
daemonize)

--smart-attach-daemon2
attach a command/daemon to the master process managed by a pidfile (the command has to
NOT daemonize)

--legion-attach-daemon
same as --attach-daemon but daemon runs only on legion lord node

--legion-smart-attach-daemon
same as --smart-attach-daemon but daemon runs only on legion lord node

--legion-smart-attach-daemon2
same as --smart-attach-daemon2 but daemon runs only on legion lord node

--daemons-honour-stdin
do not change the stdin of external daemons to /dev/null

--attach-daemon2
attach-daemon keyval variant (supports smart modes too)

--plugins
load uWSGI plugins

--plugin
load uWSGI plugins

--need-plugins
load uWSGI plugins (exit on error)

--need-plugin
load uWSGI plugins (exit on error)

--plugins-dir
add a directory to uWSGI plugin search path

--plugin-dir
add a directory to uWSGI plugin search path

--plugins-list
list enabled plugins

--plugin-list
list enabled plugins

--autoload
try to automatically load plugins when unknown options are found

--dlopen
blindly load a shared library

--allowed-modifiers
comma separated list of allowed modifiers

--remap-modifier
remap request modifier from one id to another

--dump-options
dump the full list of available options
装在所有可用的选项

--show-config
show the current config reformatted as ini
显示当前重新初始化时的设置

--binary-append-data
return the content of a resource to stdout for appending to a uwsgi binary (for data://usage)

--print
simple print
简易输出

--iprint
simple print (immediate version)
建议输出(当前生效)

--exit force exit() of the instance
强制退出当前运行实例

--cflags
report uWSGI CFLAGS (useful for building external plugins)
创建拓展插件是报告uwsgi编译器选项

--dot-h
dump the uwsgi.h used for building the core (useful for building external plugins)
创建时使用uwsgi.h

--config-py
dump the uwsgiconfig.py used for building the core (useful for building external plugins)
创建时使用uwsgiconfig.py

--build-plugin
build a uWSGI plugin for the current binary
为当前的执行文件中创建一个uwsgi的插件,即加载插件到uwsgi服务器上

--version
print uWSGI version
查看当前uwsgi版本

mysql允许远程访问操作

终端操作

  • 1、先在服务器中通过命令行方式登录mysql: mysql -uroot -p密码
  • 2、执行use mysql;
  • 3、执行grant all privileges on . to root@’%’ identified by ‘密码’;
  • 4、执行flush privileges;

数据库管理中心操作

在user表中将相应用户对应的host改为“%”​

nginx配置首页默认跳转路径

https指定路径跳转

1
rewrite ^/index.html(.*)$ 指定的跳转路径 permanent;

http跳转到https

1
2
3
4
5
6
7
server {
listen 80;
server_name localhost;
rewrite ^(.*)$ https://$host$1 permanent;
location / {
index index.html index.htm;
}

虚拟主机配置多个系统多个域名

在网站根目录htdocs下创建多个子文件夹,一个系统对应一个子文件夹

在网站根目录htdocs下创建”.htaccess”文件。

一个域名对应一段代码​
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
       RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www.)?【此处填域名】$

RewriteCond %{REQUEST_URI} !^/【此处填htdocs下子文件夹名称】/

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /【此处填htdocs下子文件夹名称】/$1

RewriteCond %{HTTP_HOST} ^(www.)?【此处填域名】$

RewriteRule ^(/)?$ 【此处填包含二级目录下的首页完整路径】 [L]

##### 示例(www.fzg5.com绑定htdocs下的fzg5子文件夹)

​ RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www.)?fzg5.com$

RewriteCond %{REQUEST_URI} !^/fzg5/

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /fzg5/$1

RewriteCond %{HTTP_HOST} ^(www.)?fzg5.com$

RewriteRule ^(/)?$ fzg5/index.html [L]