@@ -49,6 +49,84 @@ python portable.py
49
49
50
50
Then follow these simple steps
51
51
52
+ ### Customizing listening host and port, Systemd / Reverse-proxy example
53
+
54
+ ##
55
+
56
+ Installation using venv and running under specific bind address / port
57
+
58
+ ``` sh
59
+ python3 -m venv venv
60
+ source venv/bin/activate
61
+ python -m pip install -r requirements.txt
62
+ FLASK_APP=app/portable.py flask run --host=127.0.0.1 --port=9982
63
+ ```
64
+
65
+ ## Systemd Service
66
+
67
+ ```
68
+ /lib/systemd/system/13ft.service
69
+ ```
70
+
71
+ ```
72
+ [Unit]
73
+ Description=13ft Flask Service
74
+ Wants=network-online.target
75
+ After=network-online.target
76
+
77
+ [Service]
78
+ Type=simple
79
+ Restart=on-failure
80
+ RestartSec=10
81
+ User=www-data
82
+ Group=www-data
83
+ Environment=APP_PATH=/var/www/paywall-break
84
+ Environment=FLASK_APP=app/portable.py
85
+
86
+ ExecStart=/bin/bash -c "cd ${APP_PATH};${APP_PATH}/venv/bin/flask run --host=127.0.0.1 --port=22113"
87
+
88
+ # Make sure stderr/stdout is captured in the systemd journal.
89
+ StandardOutput=journal
90
+ StandardError=journal
91
+
92
+ [Install]
93
+ WantedBy=multi-user.target
94
+ ```
95
+
96
+ ## Reverse Proxy
97
+
98
+ ```
99
+ <VirtualHost *:22114>
100
+ ErrorLog ${APACHE_LOG_DIR}/13ft-error.log
101
+ CustomLog ${APACHE_LOG_DIR}/13ft-access.log combined
102
+
103
+ ProxyRequests Off
104
+
105
+ SSLEngine on
106
+ SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
107
+ SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
108
+ Header always set Strict-Transport-Security "max-age=63072000"
109
+ SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
110
+
111
+ SSLHonorCipherOrder off
112
+ SSLSessionTickets off
113
+
114
+ Protocols h2 http/1.1
115
+
116
+ <Proxy *>
117
+ Order deny,allow
118
+ Allow from all
119
+ </Proxy>
120
+
121
+
122
+ ProxyPass / http://127.0.0.1:22113/
123
+ ProxyPassReverse / http://127.0.0.1:22113/
124
+
125
+
126
+ </VirtualHost>
127
+ ```
128
+
129
+
52
130
### Step 1
53
131
54
132
![ step 1 screenshot] ( screenshots/step-1.png )
0 commit comments