[root@falcon21 ~]# vi /var/www/html/test.cgi
#!/usr/bin/perl print "Content-type: text/html\n\n"; print "<html>\n<body>\n"; print "<div style=\"width: 100%; font-size: 40px; font-weight: bold; text-align: center;\">\n"; print "CGI Test Page"; print "\n</div>\n"; print "</body>\n</html>\n"; ~ [root@falcon21 ~]# chmod 755 /var/www/html/test.cgi [root@falcon21 ~]# systemctl restart httpd --------------------- https://falcon21.space/test.cgi CGI Test Page https://falcon21.space/cgi-bin/test. cgi CGIテスト /cgi-bin/sample/内は、Internal Server Error --------------------- CGI の実行許可設定 [root@falcon21 ~]# vi /etc/httpd/conf/httpd.conf 149 #Options Indexes FollowSymLinks 150 Options Includes ExecCGI FollowSymLinks 157 AllowOverride All 170 <IfModule dir_module> 171 DirectoryIndex index.html DirectoryIndex index.html index.php index.cgi 172 </IfModule> 確認 [root@falcon21 ~]# grep -n "^ *ScriptAlias" /etc/httpd/conf/httpd.conf 254: ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" 別のディレクトリで CGI の実行許可設定 [root@falcon21 ~]# vi /etc/httpd/conf.d/cgi-enabled.conf <Directory "/var/www/html/cgi-enabled"> Options +ExecCGI AddHandler cgi-script .cgi .pl </Directory> <Directory "/var/www/cgi-bin/sample/cgi-enabled"> Options +ExecCGI AddHandler cgi-script .cgi .pl </Directory> https://falcon21.space/cgi-bin/sample/test.cgi CGIテスト ~ --------------------- ユーザーディレクトリ> とユーザー CGI の実行許可設定 [root@falcon21 ~]# vi /etc/httpd/conf.d/userdir.conf # Otherwise, the client will only receive a "403 Forbidden" message. # <IfModule mod_userdir.c> # # UserDir is disabled by default since it can confirm the presence # of a username on the system (depending on home directory # permissions). # #UserDir disabled # # To enable requests to /~user/ to serve the user's public_html # directory, remove the "UserDir disabled" line above, and uncomment # the following line instead: # UserDir html AliasMatch ^/anpachi(.*) /home/anpachi/html/$1 AliasMatch ^/hayato(.*) /home/hayato/html/$1 AliasMatch ^/kazuya(.*) /home/kazuya/html/$1 AliasMatch ^/blender(.*) /home/blender/html/$1 AliasMatch ^/anjii(.*) /home/anjii/html/$1 #AliasMatch ^/userdir/([^/]+)/(.*) /home/$1/html/$2 </IfModule> # # Control access to UserDir directories. The following is an example # for a site where these directories are restricted to read-only. # --------------------- https://falcon21.space/hayato/test.html Test Page OK. https://falcon21.space/hayato/test.cgi CGI Test Page******************************************************************* 特定のCGIが動かない場合は、 ディレクトリの所有者権限 アクセス権限・・・パーミッション ファイルの所有者権限 アクセス権限・・・パーミッション cgi ファイルの記述ミス などをチェック。 ***********************************************************************
投票数:1
平均点:10.00