質問編集履歴
5
別の環境で試行、しかし失敗
title
CHANGED
File without changes
|
body
CHANGED
@@ -121,4 +121,19 @@
|
|
121
121
|
IncludeOptional conf-enabled/*.conf
|
122
122
|
|
123
123
|
IncludeOptional sites-enabled/*.conf
|
124
|
-
```
|
124
|
+
```
|
125
|
+
|
126
|
+
EDIT3:
|
127
|
+
azure virtual machinesで同じことをしてみました。
|
128
|
+
apt update
|
129
|
+
apt upgrade
|
130
|
+
apt install tasksel
|
131
|
+
ufw allow 80
|
132
|
+
apache2.conf は、上と同じ。
|
133
|
+
|
134
|
+
which python3 => /usr/bin/python3
|
135
|
+
python3 -V => Python 3.6.9
|
136
|
+
apachectl -v => Apache/2.4.26 (Ubuntu)
|
137
|
+
apatchectl configtest => Syntax OK
|
138
|
+
|
139
|
+
しかしうまくいきません。
|
4
edit2
title
CHANGED
File without changes
|
body
CHANGED
@@ -50,4 +50,75 @@
|
|
50
50
|
print("Content_type: text/html")
|
51
51
|
print()をけして、print("Content-type: text/html\n")
|
52
52
|
|
53
|
-
4。chomd 755で実行可能にしました。
|
53
|
+
4。chomd 755で実行可能にしました。
|
54
|
+
|
55
|
+
EDIT2:
|
56
|
+
apache2.confです。#から始まる部分は消しました。
|
57
|
+
```
|
58
|
+
DefaultRuntimeDir ${APACHE_RUN_DIR}
|
59
|
+
|
60
|
+
PidFile ${APACHE_PID_FILE}
|
61
|
+
|
62
|
+
Timeout 300
|
63
|
+
|
64
|
+
KeepAlive On
|
65
|
+
|
66
|
+
MaxKeepAliveRequests 100
|
67
|
+
|
68
|
+
KeepAliveTimeout 5
|
69
|
+
|
70
|
+
User ${APACHE_RUN_USER}
|
71
|
+
Group ${APACHE_RUN_GROUP}
|
72
|
+
|
73
|
+
HostnameLookups Off
|
74
|
+
|
75
|
+
ErrorLog ${APACHE_LOG_DIR}/error.log
|
76
|
+
|
77
|
+
LogLevel warn
|
78
|
+
|
79
|
+
IncludeOptional mods-enabled/*.load
|
80
|
+
IncludeOptional mods-enabled/*.conf
|
81
|
+
|
82
|
+
Include ports.conf
|
83
|
+
|
84
|
+
<Directory />
|
85
|
+
Options FollowSymLinks
|
86
|
+
AllowOverride None
|
87
|
+
Require all denied
|
88
|
+
</Directory>
|
89
|
+
|
90
|
+
<Directory /usr/share>
|
91
|
+
AllowOverride None
|
92
|
+
Require all granted
|
93
|
+
</Directory>
|
94
|
+
|
95
|
+
<Directory /var/www/>
|
96
|
+
Options Indexes FollowSymLinks
|
97
|
+
AllowOverride None
|
98
|
+
Require all granted
|
99
|
+
</Directory>
|
100
|
+
|
101
|
+
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
|
102
|
+
AddHandler cgi-script .cgi .pl .py
|
103
|
+
<Directory "/var/www/cgi-bin">
|
104
|
+
AllowOverride None
|
105
|
+
Options +ExecCGI
|
106
|
+
Require all granted
|
107
|
+
</Directory>
|
108
|
+
|
109
|
+
AccessFileName .htaccess
|
110
|
+
|
111
|
+
<FilesMatch "^.ht">
|
112
|
+
Require all denied
|
113
|
+
</FilesMatch>
|
114
|
+
|
115
|
+
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
|
116
|
+
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
|
117
|
+
LogFormat "%h %l %u %t \"%r\" %>s %O" common
|
118
|
+
LogFormat "%{Referer}i -> %U" referer
|
119
|
+
LogFormat "%{User-agent}i" agent
|
120
|
+
|
121
|
+
IncludeOptional conf-enabled/*.conf
|
122
|
+
|
123
|
+
IncludeOptional sites-enabled/*.conf
|
124
|
+
```
|
3
追加2
title
CHANGED
File without changes
|
body
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
Apache/2.4.29 (Ubuntu)
|
3
3
|
which python3 => /usr/bin/python3
|
4
4
|
python3 -V => Python 3.6.9
|
5
|
+
installは、apt tasksel > lamp serverでインストール。
|
5
6
|
|
6
7
|
http://www.w3big.com/ja/python3/python3-cgi-programming.html
|
7
8
|
上記サイトの通りにしているのですが、pythonファイルが実行されません。
|
@@ -47,4 +48,6 @@
|
|
47
48
|
print("content-type: txt/html")
|
48
49
|
print('Content-type: text/html')
|
49
50
|
print("Content_type: text/html")
|
50
|
-
print()をけして、print("Content-type: text/html\n")
|
51
|
+
print()をけして、print("Content-type: text/html\n")
|
52
|
+
|
53
|
+
4。chomd 755で実行可能にしました。
|
2
追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,6 +17,10 @@
|
|
17
17
|
上手くcontent-typeがセット出来ていないとq&aに書かれていたのですが、、
|
18
18
|
|
19
19
|
EDIT1:
|
20
|
+
192.168.xxx.xxx/
|
21
|
+
にアクセスし、/var/www/html/index.html
|
22
|
+
が表示されるのは確認済み。
|
23
|
+
|
20
24
|
やったこと
|
21
25
|
|
22
26
|
1。/etc/apache2/apache2.confに、下の二行を追加。
|
1
環境を書き忘れて本当に申し訳ない。
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
Ubuntu server 18.04.3 LTS
|
2
|
+
Apache/2.4.29 (Ubuntu)
|
3
|
+
which python3 => /usr/bin/python3
|
4
|
+
python3 -V => Python 3.6.9
|
5
|
+
|
1
6
|
http://www.w3big.com/ja/python3/python3-cgi-programming.html
|
2
7
|
上記サイトの通りにしているのですが、pythonファイルが実行されません。
|
3
8
|
hello.pyを保存しますか、開きますかと聞かれます。
|
@@ -9,4 +14,33 @@
|
|
9
14
|
とすると、content−typeは、text/htmlになるのですがうまく表示されるわけではありません。
|
10
15
|
どうすれば、上手く上のサイトのように実行されるでしょうか?
|
11
16
|
|
12
|
-
上手くcontent-typeがセット出来ていないとq&aに書かれていたのですが、、
|
17
|
+
上手くcontent-typeがセット出来ていないとq&aに書かれていたのですが、、
|
18
|
+
|
19
|
+
EDIT1:
|
20
|
+
やったこと
|
21
|
+
|
22
|
+
1。/etc/apache2/apache2.confに、下の二行を追加。
|
23
|
+
|
24
|
+
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
|
25
|
+
AddHandler cgi-script .cgi .pl .py
|
26
|
+
|
27
|
+
2。上二行を下のように少し変えて試す。
|
28
|
+
|
29
|
+
.cgi .pl .py => cgi pl py
|
30
|
+
|
31
|
+
3。下の六行を追加。
|
32
|
+
|
33
|
+
<Directory "/var/www/cgi-bin">
|
34
|
+
AllowOverride None
|
35
|
+
Options +ExecCGI
|
36
|
+
Order allow,deny
|
37
|
+
Allow from all
|
38
|
+
</Directory>
|
39
|
+
|
40
|
+
hello.pyのcontent~~~のところをいじる。
|
41
|
+
|
42
|
+
print("Content-Type: text/html")
|
43
|
+
print("content-type: txt/html")
|
44
|
+
print('Content-type: text/html')
|
45
|
+
print("Content_type: text/html")
|
46
|
+
print()をけして、print("Content-type: text/html\n")
|