質問編集履歴
5
別の環境で試行、しかし失敗
test
CHANGED
File without changes
|
test
CHANGED
@@ -245,3 +245,33 @@
|
|
245
245
|
IncludeOptional sites-enabled/*.conf
|
246
246
|
|
247
247
|
```
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
EDIT3:
|
252
|
+
|
253
|
+
azure virtual machinesで同じことをしてみました。
|
254
|
+
|
255
|
+
apt update
|
256
|
+
|
257
|
+
apt upgrade
|
258
|
+
|
259
|
+
apt install tasksel
|
260
|
+
|
261
|
+
ufw allow 80
|
262
|
+
|
263
|
+
apache2.conf は、上と同じ。
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
which python3 => /usr/bin/python3
|
268
|
+
|
269
|
+
python3 -V => Python 3.6.9
|
270
|
+
|
271
|
+
apachectl -v => Apache/2.4.26 (Ubuntu)
|
272
|
+
|
273
|
+
apatchectl configtest => Syntax OK
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
しかしうまくいきません。
|
4
edit2
test
CHANGED
File without changes
|
test
CHANGED
@@ -103,3 +103,145 @@
|
|
103
103
|
|
104
104
|
|
105
105
|
4。chomd 755で実行可能にしました。
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
EDIT2:
|
110
|
+
|
111
|
+
apache2.confです。#から始まる部分は消しました。
|
112
|
+
|
113
|
+
```
|
114
|
+
|
115
|
+
DefaultRuntimeDir ${APACHE_RUN_DIR}
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
PidFile ${APACHE_PID_FILE}
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
Timeout 300
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
KeepAlive On
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
MaxKeepAliveRequests 100
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
KeepAliveTimeout 5
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
User ${APACHE_RUN_USER}
|
140
|
+
|
141
|
+
Group ${APACHE_RUN_GROUP}
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
HostnameLookups Off
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
ErrorLog ${APACHE_LOG_DIR}/error.log
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
LogLevel warn
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
IncludeOptional mods-enabled/*.load
|
158
|
+
|
159
|
+
IncludeOptional mods-enabled/*.conf
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
Include ports.conf
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<Directory />
|
168
|
+
|
169
|
+
Options FollowSymLinks
|
170
|
+
|
171
|
+
AllowOverride None
|
172
|
+
|
173
|
+
Require all denied
|
174
|
+
|
175
|
+
</Directory>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
<Directory /usr/share>
|
180
|
+
|
181
|
+
AllowOverride None
|
182
|
+
|
183
|
+
Require all granted
|
184
|
+
|
185
|
+
</Directory>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
<Directory /var/www/>
|
190
|
+
|
191
|
+
Options Indexes FollowSymLinks
|
192
|
+
|
193
|
+
AllowOverride None
|
194
|
+
|
195
|
+
Require all granted
|
196
|
+
|
197
|
+
</Directory>
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
|
202
|
+
|
203
|
+
AddHandler cgi-script .cgi .pl .py
|
204
|
+
|
205
|
+
<Directory "/var/www/cgi-bin">
|
206
|
+
|
207
|
+
AllowOverride None
|
208
|
+
|
209
|
+
Options +ExecCGI
|
210
|
+
|
211
|
+
Require all granted
|
212
|
+
|
213
|
+
</Directory>
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
AccessFileName .htaccess
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
<FilesMatch "^.ht">
|
222
|
+
|
223
|
+
Require all denied
|
224
|
+
|
225
|
+
</FilesMatch>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
|
230
|
+
|
231
|
+
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
|
232
|
+
|
233
|
+
LogFormat "%h %l %u %t \"%r\" %>s %O" common
|
234
|
+
|
235
|
+
LogFormat "%{Referer}i -> %U" referer
|
236
|
+
|
237
|
+
LogFormat "%{User-agent}i" agent
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
IncludeOptional conf-enabled/*.conf
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
IncludeOptional sites-enabled/*.conf
|
246
|
+
|
247
|
+
```
|
3
追加2
test
CHANGED
File without changes
|
test
CHANGED
@@ -5,6 +5,8 @@
|
|
5
5
|
which python3 => /usr/bin/python3
|
6
6
|
|
7
7
|
python3 -V => Python 3.6.9
|
8
|
+
|
9
|
+
installは、apt tasksel > lamp serverでインストール。
|
8
10
|
|
9
11
|
|
10
12
|
|
@@ -97,3 +99,7 @@
|
|
97
99
|
print("Content_type: text/html")
|
98
100
|
|
99
101
|
print()をけして、print("Content-type: text/html\n")
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
4。chomd 755で実行可能にしました。
|
2
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -35,6 +35,14 @@
|
|
35
35
|
|
36
36
|
|
37
37
|
EDIT1:
|
38
|
+
|
39
|
+
192.168.xxx.xxx/
|
40
|
+
|
41
|
+
にアクセスし、/var/www/html/index.html
|
42
|
+
|
43
|
+
が表示されるのは確認済み。
|
44
|
+
|
45
|
+
|
38
46
|
|
39
47
|
やったこと
|
40
48
|
|
1
環境を書き忘れて本当に申し訳ない。
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
Ubuntu server 18.04.3 LTS
|
2
|
+
|
3
|
+
Apache/2.4.29 (Ubuntu)
|
4
|
+
|
5
|
+
which python3 => /usr/bin/python3
|
6
|
+
|
7
|
+
python3 -V => Python 3.6.9
|
8
|
+
|
9
|
+
|
10
|
+
|
1
11
|
http://www.w3big.com/ja/python3/python3-cgi-programming.html
|
2
12
|
|
3
13
|
上記サイトの通りにしているのですが、pythonファイルが実行されません。
|
@@ -21,3 +31,61 @@
|
|
21
31
|
|
22
32
|
|
23
33
|
上手くcontent-typeがセット出来ていないとq&aに書かれていたのですが、、
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
EDIT1:
|
38
|
+
|
39
|
+
やったこと
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
1。/etc/apache2/apache2.confに、下の二行を追加。
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
|
48
|
+
|
49
|
+
AddHandler cgi-script .cgi .pl .py
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
2。上二行を下のように少し変えて試す。
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
.cgi .pl .py => cgi pl py
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
3。下の六行を追加。
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
<Directory "/var/www/cgi-bin">
|
66
|
+
|
67
|
+
AllowOverride None
|
68
|
+
|
69
|
+
Options +ExecCGI
|
70
|
+
|
71
|
+
Order allow,deny
|
72
|
+
|
73
|
+
Allow from all
|
74
|
+
|
75
|
+
</Directory>
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
hello.pyのcontent~~~のところをいじる。
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
print("Content-Type: text/html")
|
84
|
+
|
85
|
+
print("content-type: txt/html")
|
86
|
+
|
87
|
+
print('Content-type: text/html')
|
88
|
+
|
89
|
+
print("Content_type: text/html")
|
90
|
+
|
91
|
+
print()をけして、print("Content-type: text/html\n")
|