Webの最近のブログ記事

PukiWikiでページの名前が長くなると、上の表示が折り返されたりしてちょっと。
そこで山中家では、skin/pukiwiki.css.phpを修正しています。

h1.title { font-size: 24px; font-weight:bold; background-color:transparent; padding: 12px 0px 0px 0px; border: 0px; margin: 12px 0px 0px 0px; }

デフォルトでは30pxなのですが、これを24pxに。

PukiWikiはportsに無いようなので、自力で設置しましょう。
PukiWikiの情報は、FrontPage - PukiWiki.orgからどうぞ。

ダウンロード

1.4.51は、ここからダウンロードできます。
-http://prdownloads.sourceforge.jp/pukiwiki/12962/pukiwiki-1.4.5
1.tar.gz

京阪奈のミラーからダウンロードしている例

[root@jiro]~# [root@jiro]~# fetch http://keihanna.dl.sourceforge.jp/pukiwiki/12962/pukiwiki-1.4.51.tar.gz pukiwiki-1.4.51.tar.gz 100% of 251 kB 319 kBps

ファイルの解凍

ダウンロードできたら展開しましょう。

[root@jiro]~# tar pzxf pukiwiki-1.4.5_1.tar.gz

pukiwiki-1.4.5_1というディレクトリが出来ていると思います。

コピー

展開して出来たディレクトリの中身を、パーミッションなどはそのままコピーします。
最初は内部公開用に設定したバーチャルサーバにコピーして、動作確認をするのがよいでしょう。

設定

コピーしたら、pukiwiki.ini.phpを編集して、設定を行います。

// Title of your Wikisite (Define this) // and also RSS feed's channel name $page_title = 'バーチャル山中家';

  • ここの名前がページタイトルになります。

// Site admin's name (CHANGE THIS) $modifier = 'Nobuo Yamanaka';

  • ここは管理者の名前です。下の方のSite admin に表示されます。

// Site admin's Web page (CHANGE THIS) $modifierlink = 'http://www.yamanakake.com/';

  • その管理者名をクリックしたときに、ジャンプするアドレスです。

// Enable Trackback $trackback = 0;

  • トラックバックを有効にする場合は、1にします。

// Referer list feature $referer = 0;

  • リンク元を有効にする場合には、1にします。

// Disable WikiName auto-linking $nowikiname = 0;

  • WikiNameの自動リンクを無効にする場合には、1にします。

// AutoLink minimum bytes (0 = Disable) $autolink = 8;

  • 自動リンクする場合に、指定したバイトより短いとリンクしません。
    あまり小さくすると、予期せぬリンクをしちゃうので注意です。

// Enable Freeze / Unfreeze feature $function_freeze = 1;

  • 凍結機能を使用''しない''場合には、0にします。

// CHANGE THIS $adminpass = '1a1dc91c907325c69271ddf0c944bc72'; // md5('pass')

  • 管理者パスワードです。md5文字列が分からない場合には、$adminpass = md5('ここにパスワードを記載');と書くこともできます。

// Date format $date_format = 'Y-m-d';

  • 私は嫌いなので Y/m/d に変更しています。

// Send mail per update of pages $notify = 0;

  • ページの更新をメールで通知する場合には、1にします。

// Send diff only $notifydiffonly = 1;

  • 通知する場合に、1だと差分のみを、0だと全文をメールで送ります。

// SMTP server (Windows only. Usually specified at php.ini) $smtp_server = 'localhost';

  • メール通知に利用するSMTPサーバです。ローカルにSMTPサーバがセットアップされている場合には、localhostでOKです。

$notifyto = 'to@example.com'; // To: $notifyfrom = 'from@example.com'; // From:

  • 通知メールのあて先と送信者のメールアドレスを設定します。

// Subject: ($page = Page name wll be replaced) $notify_subject = '[PukiWiki] $page';

  • 通知メールのタイトルを設定できます。PukiWikiの代わりにサイト名をいれる等。

// Convert linebreaks into
$line_break = 0;

  • 改行を改行とする場合には1にします。そうでない場合には、編集画面で改行しても、ブラウザで見ると改行されません。

大体この程度設定できればOKです。(本当か?)

最近のportsではお約束です。

[root@jiro]~# ee /etc/rc.conf apache_enable="YES"

これを追加しておかないと、起動できません。
追加したら、

[root@jiro]~# /usr/local/etc/rc.d/apache.sh start

とやってみて、起動されるか確認してみましょう。

手で起動したら起動するのに、再起動しても自動的に起動できない場合、ServerNameの解決が出来ていない可能性があります。
/etc/hosts に記載するなり、DNSよりも後でapache.shが実行されるようにすればいいでしょう。

インストールが終わったら、設定ファイルを編集していきましょう。

設定ファイルの編集

portsからインストールすると、サンプルが入っています。
/usr/local/etc/apache/httpd.confです。
ここでは、修正するべき場所を中心に記載します。(Apache 1.3.33での例)

ExtendedStatus controls whether Apache will generate "full" status

information (ExtendedStatus On) or just basic information (ExtendedStatus

Off) when the "server-status" handler is called. The default is Off.

# ExtendedStatus On

  • コメントを外して、サーバステータスを詳細にする。

#

ServerAdmin: Your address, where problems with the server should be

e-mailed. This address appears on some server-generated pages, such

as error documents.

# ServerAdmin webmaster@yamanakake.com

  • 管理者のメールアドレスを設定

#

ServerName allows you to set a host name which is sent back to clients for

your server if it's different than the one the program would get (i.e., use

"www" instead of the host's real name).

# (中略) ServerName www.yamanakake.com

  • コメントを外して、サーバ名を設定。
    ただし、名前解決が出来ないと起動できない場合があります。山中家もそうでした。((DNSも自前なので、apache.shをzapache.shにリネームしたら、起動順が変わってOKになりました))

#

HostnameLookups: Log the names of clients or just their IP addresses

e.g., www.apache.org (on) or 204.62.129.132 (off).

The default is off because it'd be overall better for the net if people

had to knowingly turn this feature on, since enabling it means that

each client request will result in AT LEAST one lookup request to the

nameserver.

# HostnameLookups On

  • OffをOnにすると、ログに記載されるアクセス者のIPアドレスがホスト名に変換されます。

#

ErrorLog: The location of the error log file.

If you do not specify an ErrorLog directive within a

container, error messages relating to that virtual host will be

logged here. If you do define an error logfile for a

container, that host's errors will be logged there and not here.

# ErrorLog /var/log/apache/httpd-error.log

  • エラーがあったときのログ。デフォルトは/var/log/httpd-error.logだが、さっき作ったディレクトリに変更。

#

If you prefer a single logfile with access, agent, and referer information

(Combined Logfile Format) you can use the following directive.

# CustomLog /var/log/apache/httpd-access.log combined

  • 通常アクセスのログ。デフォルトは/var/log/httpd-access.log combinedだが、さっき作ったディレクトリに変更。

#

Optionally add a line containing the server version and virtual host

name to server-generated pages (error documents, FTP directory listings,

modstatus and modinfo output etc., but not CGI generated documents).

Set to "EMail" to also include a mailto: link to the ServerAdmin.

Set to one of: On | Off | EMail

# ServerSignature Off ServerTokens ProductOnly

  • エラーページなどに表示される情報を制限しておく。そうしないとバージョンなんかがばれて、セキュリティ対策が遅れると狙われるなどのリスクがあるため。
    まぁ、お客さんにバージョンを示す必要はないので。

#

Allow server status reports, with the URL of http://servername/server-status

Change the ".example.com" to match your domain to enable.

# SetHandler server-status Order deny,allow Deny from all Allow from 192.168.1.0/24 127.0.0.1 * サーバーステータスは、デフォルトではコメントになっていますが、ローカルからのみアクセスできるようにしておいて、有効にしておきます。
アドレスは、環境に合わせてくださいね。

#

Allow remote server configuration reports, with the URL of

http://servername/server-info (requires that mod_info.c be loaded).

Change the ".example.com" to match your domain to enable.

# SetHandler server-info Order deny,allow Deny from all Allow from 192.168.1.0/24 127.0.0.1

  • サーバーインフォメーションも、デフォルトではコメントになっていますが、ローカルからのみアクセスできるようにしておいて、有効にしておきます。

#

Use name-based virtual hosting.

# NameVirtualHost *:80

  • バーチャルホストを使うことで、ワームからのアクセスなどを切り分けることが出来ます。
    また、山中家の様に複数のドメインや、各ドメインにさらに複数のサイトを構築できます。

バーチャルホストの設定の書き方は、TAKE-LABOさんが大変参考になります。

例によってTAKE-LABOさんをありがたく参考にさせていただきつつ・・・

さて、上記のページの冒頭に、suEXECを有効にする云々と書かれていますね。
で、suEXECってなんじゃろ?と思い、Google先生に聞いてみると、ここが出てきました。

''suEXEC'' 機能により、Apache ユーザは Web サーバを実行しているユーザ ID とは 異なるユーザ ID で CGI プログラムや SSI プログラムを実行することができます。CGI プログラムまたは SSI プログラムを実行する場合、通常は web サーバと同じユーザで実行されます。 (http://httpd.apache.org/docs-2.0/ja/suexec.htmlより引用)

以下、このsuEXECに関する記載についてよく読んでいただいたとして、進みます。

portinstallのための準備

portinstallでsuExecを有効にするために、pkgtools.confを編集しておきます。

[root@jiro]/usr/ports# ee /usr/local/etc/pkgtools.conf (前略) MAKEARGS = { 'www/apache13' => 'WITHAPACHE_SUEXEC=yes', } (後略)

インストール

では、portinstallでインストールしましょう。

[root@jiro]/usr/ports# portinstall www/apache13

ログ保管場所の作成

ログの保管場所を作成しておきます。

[root@freebsd]/usr/ports# mkdir /var/log/apache

このアーカイブについて

このページには、過去に書かれたブログ記事のうちWebカテゴリに属しているものが含まれています。

前のカテゴリはUpdateです。

次のカテゴリは自宅サーバです。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。