お知らせ

  • 利用規約を守って投稿してください。また、よくある質問および投稿の手引きも参照してください。
  • メッセージの投稿にはアカウントが必要です。未登録の方は、ユーザ登録ページからアカウントを作成することができます。

#1 2013-12-16 09:50:59

manilow
メンバ
登録日: 2013-12-01

UBUNTU 12.04 server apache2の設定につて

http://www.server-world.info/query?os=Ubuntu_12.04&p=initial_conf&f=3

の「Webサーバー」の(3)rubyのインストールまでやりました。


家庭内LAN(windows)から

http://192.168.0.7/index.php

を実行すると、

index.phpをwindowsにダウンロードしようとするダイアログが出てきます。

また

http://192.168.0.7/index.rb

を実行すると次のメッセージで「内部のエラーがある」というメッセージ

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, *****@******** and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


error.logは次のようになっています。

[Mon Dec 16 09:35:24 2013] [notice] caught SIGTERM, shutting down
[Mon Dec 16 09:35:25 2013] [notice] Apache/2.2.22 (Ubuntu) configured -- resuming normal operations
[Mon Dec 16 09:36:54 2013] [error] (13)Permission denied: exec of '/var/www/index.rb' failed
[Mon Dec 16 09:36:54 2013] [error] [client 192.168.0.63] Premature end of script headers: index.rb

apache2の書籍をとって勉強します。が、届くのがあと1週くらいかかるので、質問してみました。

どうぞよろしくお願いいたします。

オフライン

 

#2 2013-12-16 11:30:43

si
メンバ
From: hokkaido kitami, jp
登録日: 2007-01-15

Re: UBUNTU 12.04 server apache2の設定につて

index.rb に、実行権はついてますか?
php は、動作していない様に見えます。

オフライン

 

#3 2013-12-16 13:01:02

manilow
メンバ
登録日: 2013-12-01

Re: UBUNTU 12.04 server apache2の設定につて

si による投稿:

index.rb に、実行権はついてますか?
php は、動作していない様に見えます。

php は、もう一度インストールしましたら、競合しているファイルがありました。それをクリアしたことを再度確かめて実行すると、動きました!!!

index.rb

には、次のコマンドを与えています。

chmod 705 /var/www/index.rb

これは全く別のものでしょうか?(知識不足でごめんなさい)

Internal Server Error

500 のエラーが出ます。

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, ***@******* and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

オフライン

 

#4 2013-12-16 16:48:19

si
メンバ
From: hokkaido kitami, jp
登録日: 2007-01-15

Re: UBUNTU 12.04 server apache2の設定につて

CGIは、有効になってますか?
( /etc/apache2/sites-available/default 10行目 あたりの Options に、ExecCGI が追加されているか?)

オフライン

 

#5 2013-12-16 16:54:58

manilow
メンバ
登録日: 2013-12-01

Re: UBUNTU 12.04 server apache2の設定につて

si による投稿:

CGIは、有効になってますか?
( /etc/apache2/sites-available/default 10行目 あたりの Options に、ExecCGI が追加されているか?)

そのまま、

cat /etc/apache2/sites-available/default 

したファイル内容を貼り付けてみます。

        ServerAdmin ***@*******

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options FollowSymLinks ExecCGI
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

いかがでしょうか?もうちょっとです。
これが終わるともう一つ、サーバーの構築に関しての質問があるのですが、内容はまったく別になるので、新規の質問をあげます。
よろしくお願いいたします。

オフライン

 

#6 2013-12-16 21:17:54

si
メンバ
From: hokkaido kitami, jp
登録日: 2007-01-15

Re: UBUNTU 12.04 server apache2の設定につて

/etc/apache2/sites-available/default は問題ないみたいですね。
残るは、 /var/www/index.rb 本体ですね。

オフライン

 

#7 2013-12-17 12:51:36

manilow
メンバ
登録日: 2013-12-01

Re: UBUNTU 12.04 server apache2の設定につて

si による投稿:

/etc/apache2/sites-available/default は問題ないみたいですね。
残るは、 /var/www/index.rb 本体ですね。

index.rb
の内容です。


#!/usr/bin/ruby

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 "Ruby Test Page<br />"
print Time.now.strftime('%Y/%m/%d')
print "\n</div>\n"
print "</body>\n</html>\n"

バックスラッシュが\になっていますが、UBUNTU12.04desktopでテキストエディタで編集しました。
編集が、ネットの画面のコピペですが、scpしました。それがいけなかったのでしょうか?

index.cgi
index.php

はOKです。もうすぐできそうです。
どうなんでしょうか?

オフライン

 

#8 2013-12-17 13:29:33

manilow
メンバ
登録日: 2013-12-01

Re: UBUNTU 12.04 server apache2の設定につて

manilow による投稿:

si による投稿:

/etc/apache2/sites-available/default は問題ないみたいですね。
残るは、 /var/www/index.rb 本体ですね。

index.rb
の内容です。


#!/usr/bin/ruby

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 "Ruby Test Page<br />"
print Time.now.strftime('%Y/%m/%d')
print "\n</div>\n"
print "</body>\n</html>\n"

バックスラッシュが\になっていますが、UBUNTU12.04desktopでテキストエディタで編集しました。
編集が、ネットの画面のコピペですが、scpしました。それがいけなかったのでしょうか?

index.cgi
index.php

はOKです。もうすぐできそうです。
どうなんでしょうか?

cat /var/www/index.rb

でみると、バックスラッシュが、¥になっています。

UBUBTUのdesktopでやったのはいいが、webからのコピペがいけなかったようです。viで編集し直します。無駄な投稿を増やしすみませんでした。しかし、Linux上のファイル編集ではきちんとバックスラッシュが出ていて、それで、scpすると、¥になるなんてあるのでしょうか?不思議です。

オフライン

 

#9 2013-12-17 15:07:08

manilow
メンバ
登録日: 2013-12-01

Re: UBUNTU 12.04 server apache2の設定につて

manilow による投稿:

manilow による投稿:

si による投稿:

/etc/apache2/sites-available/default は問題ないみたいですね。
残るは、 /var/www/index.rb 本体ですね。

index.rb
の内容です。


#!/usr/bin/ruby

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 "Ruby Test Page<br />"
print Time.now.strftime('%Y/%m/%d')
print "\n</div>\n"
print "</body>\n</html>\n"

バックスラッシュが\になっていますが、UBUNTU12.04desktopでテキストエディタで編集しました。
編集が、ネットの画面のコピペですが、scpしました。それがいけなかったのでしょうか?

index.cgi
index.php

はOKです。もうすぐできそうです。
どうなんでしょうか?

cat /var/www/index.rb

でみると、バックスラッシュが、¥になっています。

UBUBTUのdesktopでやったのはいいが、webからのコピペがいけなかったようです。viで編集し直します。無駄な投稿を増やしすみませんでした。しかし、Linux上のファイル編集ではきちんとバックスラッシュが出ていて、それで、scpすると、¥になるなんてあるのでしょうか?不思議です。

windowsから見たのがいけませんでした。フィルは\で入っています。今はUBUNTUdesktopからです。そうすると、あと他に考えられることは?

オフライン

 

#10 2013-12-17 18:00:17

si
メンバ
From: hokkaido kitami, jp
登録日: 2007-01-15

Re: UBUNTU 12.04 server apache2の設定につて

manilow による投稿:

バックスラッシュが\になっていますが、UBUNTU12.04desktopでテキストエディタで編集しました。

半角の円マークとバックスラッシュの文字コードは同じです。
表示する環境で表示される文字形状が異なるだけですので、問題ありません。

オフライン

 

#11 2013-12-17 18:12:08

manilow
メンバ
登録日: 2013-12-01

Re: UBUNTU 12.04 server apache2の設定につて

si による投稿:

manilow による投稿:

バックスラッシュが\になっていますが、UBUNTU12.04desktopでテキストエディタで編集しました。

半角の円マークとバックスラッシュの文字コードは同じです。
表示する環境で表示される文字形状が異なるだけですので、問題ありません。

さて、もう一度、
(3)rubyのinstall
の項目でおかしいところがないか確認してみます。安心しましたが、この問題だと思ったので、また壁です。

オフライン

 

#12 2013-12-17 18:25:52

manilow
メンバ
登録日: 2013-12-01

Re: UBUNTU 12.04 server apache2の設定につて

manilow による投稿:

さて、もう一度、
(3)rubyのinstall
の項目でおかしいところがないか確認してみます。安心しましたが、この問題だと思ったので、また壁です。

---------------------------
AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi .pl .rb

---------------------------
errot.logからです。

[Tue Dec 17 18:17:40 2013] [notice] caught SIGTERM, shutting down
[Tue Dec 17 18:17:41 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.9 with Suhosin-Patch configured -- resuming normal operations
[Tue Dec 17 18:18:37 2013] [error] [client 192.168.0.63] (2)No such file or directory: exec of '/var/www/index.rb' failed
[Tue Dec 17 18:18:37 2013] [error] [client 192.168.0.63] Premature end of script headers: index.rb
[Tue Dec 17 18:18:38 2013] [error] [client 192.168.0.63] File does not exist: /var/www/favicon.ico
[Tue Dec 17 18:18:38 2013] [error] [client 192.168.0.63] File does not exist: /var/www/favicon.ico


favicon.ico がないと言うことですが、何か手がかりになりますか?
 

オフライン

 

#13 2013-12-17 19:30:44

manilow
メンバ
登録日: 2013-12-01

Re: UBUNTU 12.04 server apache2の設定につて

この辺の問題でしょうか?

http://nobuit.blog56.fc2.com/blog-entry-164.html

オフライン

 

#14 2013-12-17 21:12:36

si
メンバ
From: hokkaido kitami, jp
登録日: 2007-01-15

Re: UBUNTU 12.04 server apache2の設定につて

manilow による投稿:

この辺の問題でしょうか?

http://nobuit.blog56.fc2.com/blog-entry-164.html

そうです。
空のファイルでも置いておけば良いと思います。
例: sudo touch /var/www/favicon,ico
(アイコンを作る 参考: http://www.linuxproblem.org/art_19.html )

オフライン

 

#15 2013-12-18 11:59:28

manilow
メンバ
登録日: 2013-12-01

Re: UBUNTU 12.04 server apache2の設定につて

si による投稿:

そうです。
空のファイルでも置いておけば良いと思います。
例: sudo touch /var/www/favicon,ico
(アイコンを作る 参考: http://www.linuxproblem.org/art_19.html )

favicon,ico(favicon.ico)を作って置きました。
嬉々として、実行してみたら、

500 の error が出ました。

index.rbを別の簡単なものに変えて、もう一度実行しerrorがでるなら、何か別のパラメーターがおかしい、と言うことですね。
これくらいでしょうか?

[Wed Dec 18 11:52:48 2013] [notice] caught SIGTERM, shutting down
[Wed Dec 18 11:52:49 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.9 with Suhosin-Patch configured -- resuming normal operations
[Wed Dec 18 11:53:04 2013] [error] [client 192.168.0.63] (2)No such file or directory: exec of '/var/www/index.rb' failed
[Wed Dec 18 11:53:04 2013] [error] [client 192.168.0.63] Premature end of script headers: index.rb

オフライン

 

Board footer

Powered by FluxBB