#
/etc/init.d/apache2 reload |
#AddDefaultCharset UTF-8 |
ServerTokens Prod <--- Full をProdに変更。サーバーの情報(バージョン、OSなど)を表示しないように ServerSignature Off ++++++++++++++++++++++ここから下はetchのとき AddHandler cgi-script .cgi <----ここは先頭のコメントを外しておく AddHandler cgi-script .pl <----------追加 PerlのCGIも動くようにする。 AddHandler server-parsed .shtml <---- 追加 .shtmlのSSIが動くようにする。 |
#
a2enmod cgi |
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.shtml |
<VirtualHost *:80>
<-----ポート番号指定 ServerAdmin hoge@hoge.example.com DocumentRoot /home/hoge/public_html/ <Directory /home/hoge/public_html> Options ExecCGI Indexes FollowSymLinks MultiViews Includes <ーーーー (CGI,SSIが動くようにExecCGI Includesを追加) AllowOverride None Order allow,deny allow from all ServerSignature Off <--- サーバー情報を表示しないようにする AddHandler cgi-script .cgi <---- *.cgiを動かす AddHandler cgi-script .pl <---------- 追加 PerlのCGIも動くように する。 </Directory> ここから下7行使わないのでコメントアウト # 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> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> <Directory "/home/*/public_html"> AllowOverride None Options ExecCGI -MultiViews +SymLinksIfOwnerMatch Includes Order allow,deny Allow from all ServerSignature Off <--- サーバー情報を表示しないようにする AddHandler cgi-script .cgi <---- *.cgiを動かす AddHandler cgi-script .pl <----------追加 PerlのCGIも動くように する。 </Directory> </VirtualHost> |
# a2ensite hoge.example.com |
・ ・ ・ Alias /hogehoge/ "/home/hogehoge/public_html/" </VirtualHost> |
apr_sockaddr_info_get() failed for |
ServerName localhost |
_default_ virtualhost overlap on port
443 |
# If you just change
the port or add more ports here, you will likely also # have to change the VirtualHost statement in # /etc/apache2/sites-enabled/000-default # This is also true if you have upgraded from before 2.2.9-3 (i.e. from # Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and # README.Debian.gz NameVirtualHost *:80 Listen 80 <IfModule mod_ssl.c> # If you add NameVirtualHost *:443 here, you will also have to change # the VirtualHost statement in /etc/apache2/sites-available/default-ssl # to <VirtualHost *:443> # Server Name Indication for SSL named virtual hosts is currently not # supported by MSIE on Windows XP. NameVirtualHost *:443 Listen 443 </IfModule> <IfModule mod_gnutls.c> NameVirtualHost *:443 Listen 443 </IfModule> |
# apt-get install ruby eruby libapache2-mod-ruby |
LoadModule ruby_module /usr/lib/apache2/modules/mod_ruby.so <IfModule mod_ruby.c> # Ruby セーフレベルの設定 RubySafeLevel 1 # for Apache::RubyRun RubyRequire apache/ruby-run # for Apache::ERubyRun RubyRequire apache/eruby-run # eRuby として扱うファイルの拡張子の指定をする # handle *.rhtml as eruby files. <Files *.rhtml> SetHandler ruby-object RubyHandler Apache::ERubyRun.instance </Files> </IfModule> |
・ ・ ・ DocumentRoot /home/hoge/public_html/ <Directory /home/hogei/public_html> Options ExecCGI Indexes FollowSymLinks MultiViews Includes AllowOverride None Order allow,deny allow from all ServerSignature Off AddHandler cgi-script .pl AddHandler cgi-script .cgi AddType text/html .shtml .rhtml </Directory> ・ ・ ・ <Directory "/home/*/public_html"> AllowOverride None Options ExecCGI -MultiViews +SymLinksIfOwnerMatch Includes Order allow,deny Allow from all ServerSignature Off AddHandler cgi-script .pl AddHandler cgi-script .cgi AddType text/html .shtml .rhtml </Directory> ・ ・ ・ |
#!/usr/bin/ruby -Ku #ヘッダー部 puts "Content-Type: text/html" puts #ここでひとつ改行コードを送る #body部 print <<"EOB" <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf8"> <title>Ruby!</title> </head> <body> <h3>Hello</h3> <p>これは、おためしサンプルです。</p> </body> </html> EOB |
$ chmod 755 tameshi.cgi |
<% msg="うめこみ"%> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf8"> <title>Ruby!</title> </head> <body> <h3>Hello</h3> <%=msg%> </body> </html> |
$ chmod 755 hello.rhtml |
#SSLRequireSSL AuthUserFile /home/karappi/.htpasswd AuthGroupFile /dev/null AuthName "Input ID and Password." AuthType Basic require valid-user <Files ~ "^.(htpasswd|htaccess)$"> deny from all </Files> |
AllowOverride All |