elementary OSで、CGI(Perl)を、public_html配下で動かす方法。
[crayon]
# which perl
/usr/bin/perl
# ln -s /usr/bin/perl /usr/local/bin/perl
# apt-get install apache2
# a2enmod userdir
# vi /etc/apache2/mods-enabled/userdir.conf
  
       UserDir public_html
       UserDir disabled root
       
               AllowOverride All (変更する。)
               Options ExecCGI FollowSymLinks (変更する。)
               
                       Order allow,deny
                       Allow from all
               
               
                       Order deny,allow
                       Deny from all
               
       
  
# vi /etc/apache2/httpd.conf
  AddHandler cgi-script .cgi .pl
  ServerName localhost
  DirectoryIndex index.html index.htm index.cgi
  
       DocumentRoot /home/USERNAME/public_html/html/hogehoge1
       ServerName hoge1.gedatsu.jp
  
  
       DocumentRoot /home/USERNAME/public_html/html/hogehoge2
       ServerName hoge2.gedatsu.jp
  
# /etc/init.d/apache2 restart
[/crayon]
ここで、Web Patioという、掲示板を試験的にインストールします。
http://www.kent-web.com/bbs/patio.htmlから、各自ダウンロードしてください。
このCGIは、FFFTPか、WinSCPなどで、サーバー側に解凍した物をASCII形式でUPLOADしないと、後で、CGIをブラウザで閲覧したら、”Internal Server Error”が表示されます。
お気を付け下さい。
※chmod,chownを適切に行なって下さい。(重要です)
パーミッション”755″にしたい場合には、次のように打ちます。
[crayon]# chmod 755 patio.cgi[/crayon]
“patio”フォルダ以下のファイル所有者を”USERNAME”に設定する場合には、次のように打ちます。
[crayon]# chown -R USERNAME. /home/USERNAME/public_html/html/hogehoge1/patio[/crayon]
“init.cgi”を、各々説明に従って、設定して下さい。
そして、自宅サーバーの場合には、Hosts Fileを変更する。
Hosts Fileの置き場所は、Windows 8.1では、下記の通りです。
[crayon]C:\Windows\System32\Drivers\etc\hosts[/crayon]
LinuxのHosts Fileの置き場所は、[crayon]/etc/hosts[/crayon]です。
[crayon]192.168.0.100 hoge1.gedatsu.jp hoge2.gedatsu.jp[/crayon]
さて、ここまで設定したら、ブラウザで、次のように打って、CGIが表示されるか、確かめましょう。
(例1)http://hoge1.gedatsu.jp/patio/patio.cgi
(例2)http://hoge2.gedatsu.jp/patio/patio.cgi
 
				
			
 WordPressの管理画面を表示し、「外観」→「テーマ編集」→「右メニューの”メインインデックスのテンプレート index.php”を選択」します。
WordPressの管理画面を表示し、「外観」→「テーマ編集」→「右メニューの”メインインデックスのテンプレート index.php”を選択」します。



