「Fedora36」Apache2.4.53でCGIスクリプトを利用する

環境
OSバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# cat /etc/redhat-release
Fedora release 36 (Thirty Six)
# cat /etc/redhat-release Fedora release 36 (Thirty Six)
# cat /etc/redhat-release
Fedora release 36 (Thirty Six)

httpdバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# httpd -V
Server version: Apache/2.4.53 (Fedora Linux)
# httpd -V Server version: Apache/2.4.53 (Fedora Linux)
# httpd -V
Server version: Apache/2.4.53 (Fedora Linux)

操作方法
1.テストスクリプトを作成します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# cat > /var/www/cgi-bin/index.cgi <<'EOF'
#!/usr/bin/python3
print("Content-type: text/html\n")
print("Study CGI Script Become smart")
> EOF
# cat > /var/www/cgi-bin/index.cgi <<'EOF' #!/usr/bin/python3 print("Content-type: text/html\n") print("Study CGI Script Become smart") > EOF
# cat > /var/www/cgi-bin/index.cgi <<'EOF'
#!/usr/bin/python3
print("Content-type: text/html\n")
print("Study CGI Script Become smart")
> EOF

2.ファイルの権限を付与します
# chmod 755 /var/www/cgi-bin/index.cgi

3.curlコマンドで動作を確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# curl localhost/cgi-bin/index.cgi
Study CGI Script Become smart
# curl localhost/cgi-bin/index.cgi Study CGI Script Become smart
# curl localhost/cgi-bin/index.cgi
Study CGI Script Become smart

 

Fedora 36

Posted by arkgame