MAIN | OFFCIAL | BBS | DOWNLOAD | MIRROR |
再インストール時に Webサーバーもインストールし、起動もしてあったのでユーザーホルダーの設定と httpd.confの設定をする。
$ /sbin/service httpd start
※ 間違った httpdの起動だったかも知れないが Fedora起動時の詳細表示で httpd [起動]を確認し Test Pageも確認していた。
$ chmod 701 ~
$ mkdir -m 705 ~/public_html
httpdのフォルダー確認
$ whereis httpd
httpd: /usr/sbin/httpd /usr/sbin/httpd.worker /etc/httpd 〜省略〜
※ /etc/httpd/confにある httpd.confを httpd.conf.orgとしてバックアップをとってから設定の変更をした。
Listen 127.0.0.1:80
ServerName 127.0.0.1:80
# UserDir disable
UserDir public_html
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes FollowSymLinks Includes ExecCGI
</Directory>
AddDefaultCharset UTF-8 ← このまま設定 ※変更
AddHandler cgi-script .cgi
※ shift-jisを表示する時エンコードし直すのが面倒になったので 変更 した。
#AddDefaultCharset UTF-8 ← 変 更
※※ php 設定 追加
#
# TypesConfig describes where the mime.types file (or equivalent) is
# to be found.
#
TypesConfig /etc/mime.types
AddType application/x-httpd-php .php .inc .html .htm ← 追 加
参考とは違って、HTTPDは起動済なので restart してみたところ 起動に失敗した。
$ /sbin/service httpd restart
httpd を停止: [成功]
httpd を起動: [失敗]
その後バックアップしてあった httpd.conf.orgを戻して startしても駄目だった。 また、参考ページのコマンドも試してみたが駄目だった。
システムをリブートして起動の詳細を見ても、httpdは [失敗] だった。
その後
「某店長」のアドバイスで SELinuxを無効に設定して httpdを起動したら成功した。
$ /sbin/service httpd start
httpd を起動: [成功]
※ 自分は SELinuxが何をするものか理解していない・・・・
ブラウザのアドレス欄に "http://localhost/~hoge/" と入力したら 空のフォルダーが見れた。 次に適当な index.htmlを /home/hoge/public_html にコピーしてブラウザで表示する事を確認した。
テスト CGIを作成するために perl位置を確認
$ whereis perl
perl: /usr/bin/perl 〜省略〜
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "<html>\n";
print "<head>\n";
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n";
print "<title>CGIテスト</title>\n";
print "</head>\n";
print "<body>\n";
print "CGIテスト\n";
print "</body>\n";
print "</html>\n";
CGIテスト
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SSIテスト</title>
<body>
SSIテスト
<!--#config timefmt="%Y/%m/%d %H:%M:%S" -->
<!--#echo var="DATE_LOCAL" -->
</body>
</html>
SSIテスト 2007/06/10 07:06:57
<?PHP
phpinfo();
?>
〜 省 略 〜 実際の結果表示 別窓で開きます。
<?PHP
echo "<br>Hello, world!!<br><br>\n";
?>
Hello, world!!
<?php
print "---------------<br>\n";
include 'helo.php';
print "---------------<br>\n";
?>
---------------
Hello, world!!
---------------
<html>
<body>
---------------<br>
<?php
include 'helo.php';
?>
---------------<br>
</body>
</html>
---------------
---------------
---------------
Hello, world!!
---------------
※※※ ルートで httpd.conf 編修後 httpdの再起動無しでの 設定変更が ブラウザから確認出来た。
<?PHP
include ('helo.php');
include 'helo.php';
?>