ラベル Apache の投稿を表示しています。 すべての投稿を表示
ラベル Apache の投稿を表示しています。 すべての投稿を表示

2010年1月30日土曜日

1/28 Apache HTTP Server 2.3.5 Alpha

Apache HTTP Server 2.3.5-alpha Released
http://mail-archives.apache.org/mod_mbox/www-announce/201001.mbox/%3C4239a4321001281159n6c8abe32i216965abeed68aac@mail.gmail.com%3E

Overview of new features in Apache 2.4 - Apache HTTP Server
http://httpd.apache.org/docs/trunk/new_features_2_4.html

参考
Apache 3.0構想発表 - 抜本的性能向上へ | エンタープライズ | マイコミジャーナル
http://journal.mycom.co.jp/news/2007/02/16/364.html

2010年1月3日日曜日

Install Tutorial: Ubuntu 9.10, Apache with SSL, Subversion over HTTP / HTTPs(digest authentication), and Trac

例によって
Install Tutorial: Ubuntu 9.04, Apache with SSL, Subversion over HTTP / HTTPs, and Trac - NewInstance
http://en.newinstance.it/2009/08/27/tutorial-ubuntu-904-apache-with-ssl-subversion-over-http-https-and-trac/
を元ネタ・たたき台にする。


-http/httpsで同じコンテンツが見られるようにする
-Subversion/tracの認証はdigest

SVNクライアントはrapidsvn,kdesvnなどが良い。

SSLの証明書については
[SOLVED] HOWTO How to renew an expired Dovecot IMAP/POP3 SSL certificate - Ubuntu Forums
http://ubuntuforums.org/showthread.php?t=707161
などを参照。

sudo cat /etc/ssl/private/ssl-cert-snakeoil.key
であらかじめ入っているものが見られる。


apt-getでのインストール時に必要であれば--no-install-recommendsというオプションをつける。


Apache2,Subversionをいれる。
$ sudo apt-get install subversion curl apache2 libapache2-svn

-Apache2の設定を整理する
$ sudo a2dissite default
$ sudo /etc/init.d/apache2 stop

http/httpsで同じ内容を見せる際にdefault/default-sslの両方の内容を同じように編集するのは無駄なので片寄せする
$ cd /etc/apache2/sites-available/
$ sudo cp default 100-default
$ sudo cp default 101-default-core
$ sudo cp default-ssl 102-default-ssl

100と102が101の設定をincludeするように設定する。
101を変更すれば100(http),102(https)のディレクトリ構成が同時に変更される。


最初と最後のVirtualHostの行を削る
$ sudo gedit 101-default-core
ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
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>

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>

最初と最後のVirtualHost以外を消してIncludeに置き換える
$ sudo gedit 100-default
<VirtualHost *:80>
Include /etc/apache2/sites-available/101-default-core
</VirtualHost>

VirtualHost内のServerAdmin~Directoryタグの内容をIncludeに置き換える
$ sudo gedit 102-default-ssl
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
Include /etc/apache2/sites-available/101-default-core

# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
$ sudo gedit ../ports.conf
IfModuleの所にNameVirtualHost *:443を追加する
NameVirtualHost *:80
Listen 80

<IfModule mod_ssl.c>
# SSL name based virtual hosts are not yet supported, therefore no
# NameVirtualHost statement here
NameVirtualHost *:443
Listen 443
</IfModule>

siteのload
$ sudo a2ensite 100-default
$ sudo a2ensite 102-default-ssl

Apacheの起動
$ sudo a2enmod ssl
$ sudo /etc/init.d/apache2 start

動作確認
$ curl http://localhost/
$ curl -k https://localhost/


/varの容量を割り当てるのは熟練した運用の経験が必要な為、/home以下に各種環境を構築する

$ sudo mkdir /home/svn
任意のproject名でdirectoryを作る。ここでは「project1」
$ sudo mkdir /home/svn/project1
$ sudo chown www-data.www-data /home/svn/project1
$ sudo -u www-data svnadmin create /home/svn/project1

(必要に応じてバックアップ$ sudo cp /etc/apache2/mods-available/dav_svn.conf /etc/apache2/mods-available/dav_svn.conf.bak)
$ sudo gedit /etc/apache2/mods-available/dav_svn.conf

末尾に以下を追加
<Location /svn/project1>
DAV svn
SVNPath /home/svn/project1
AuthType Digest
AuthName "project1"
AuthUserFile /etc/subversion/project1.passwd
Require valid-user
</Location>

$ sudo htdigest -c /etc/subversion/project1.passwd "project1" svnuser
-cは新しくpasswdファイルを作る場合。""の中はAuthNameで設定したもの。最後が追加するユーザー名。
$ sudo a2enmod auth_digest
$ sudo /etc/init.d/apache2 restart

*ここではpasswordは「test」にした場合
$ curl --digest http://svnuser:test@localhost/svn/project1/
$ curl --digest -k https://svnuser:test@localhost/svn/project1/


tracのインストール

$ sudo apt-get install trac libapache2-mod-python
$ sudo mkdir /home/trac
$ sudo chown www-data.www-data /home/trac

100と102に読み込まれるtracの共通設定103を作る。
$ sudo gedit /etc/apache2/sites-available/103-default-trac

<Location /trac>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /home/trac
PythonOption TracUriRoot /trac
PythonOption PYTHON_EGG_CACHE /tmp
</Location>

<LocationMatch "/trac/[[:alnum:]]+/login">
AuthType Digest
AuthName "trac"
AuthUserFile /etc/trac/trac.passwd
Require valid-user
</LocationMatch>

100(http)に103を読み込む
$ sudo gedit /etc/apache2/sites-available/100-default
<VirtualHost *:80>
Include /etc/apache2/sites-available/101-default-core
Include /etc/apache2/sites-available/103-default-trac
</VirtualHost>


102(https)に103を読み込む
$ sudo gedit /etc/apache2/sites-available/102-default-ssl
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
Include /etc/apache2/sites-available/101-default-core
Include /etc/apache2/sites-available/103-default-trac

101と103を読み込むものを作ってそれを100,102で読み込んでも良い。

$ sudo htdigest -c /etc/trac/trac.passwd "trac" svnuser
$ sudo -u www-data trac-admin /home/trac/project1 initenv

Project Name [My Project]> project1
Database connection string [sqlite:db/trac.db]>
Repository type [svn]>
Path to repository [/path/to/repos]> /home/svn/project1

$ sudo /etc/init.d/apache2 restart
$ sudo -u www-data trac-admin /home/trac/project1 permission add svnuser TRAC_ADMIN


sites-availableに単体で完結しないsite設定があるのが気持ち悪い場合はどうしたものか。
-/etc/subversion/project1.passwd
-/etc/trac/trac.passwd
これらsvnとtracの認証のpasswdはrealmを同じにすれば統一出来るので一括して変更が可能になる。


to doというか備忘録というか後でやるLDAP
http://blog.acmelab.org/2007/09/02/ubuntu-server-setup-lampldapsvntracmoinmoin/

2009年12月4日金曜日

Windows XPとApacheとPHP

Windows XP + Apache 2.2.14 + PHP 5.2.11はbugで?DB系のmoduleを読み込んでいると動かず、5.2.10だと動く。5.3系、5.3.1はapache用のdllがそもそも含まれていない様子。深くは調べていない。5.2.11を入れてしまってapacheが動かない場合はphp.iniのmoduleの読み込みを一旦comment outして、何が原因か1つずつ調べる。

2009年11月16日月曜日

Ubuntu 9.10(i386) + Apache 2.2.14 + PHP 5.2.11 + ZendFramework 1.9.5

人によって入れるpkgは違うのでapache,php5まわりは少なめ。
以下を落として
$ sudo dpkg -i *.deb
Zend Frameworkは以下でpathの通りが若干幸せになれるかも。何故libzend-framework-phpが挟まる必要があるのか詳しくないので理解出来ない。
$ sudo ln -s /usr/share/php/libzend-framework-php/Zend/ /usr/share/php/Zend

Ubuntu 10.04 Lucid LynxがPHP 5.3を積まないつもりなのか若干不安。
.deb fileはDebianのもの
http://packages.debian.org/source/experimental/php5
をそのまま使う事は出来る筈。

php-pearはdebで最新版を拾う必要はなく
$ sudo pear update-channels
$ sudo pear upgrade-all
とか何とか。


Zend Framework 1.9.5
http://framework.zend.com/changelog/1.9.5
https://launchpad.net/ubuntu/lucid/+search?text=zend

deb
http://launchpadlibrarian.net/35086091/zend-framework_1.9.5-0ubuntu1_all.deb
http://launchpadlibrarian.net/35086090/zend-framework-bin_1.9.5-0ubuntu1_all.deb
http://launchpadlibrarian.net/35086089/libzend-framework-php_1.9.5-0ubuntu1_all.deb


PHP 5.2.11
http://www.php.net/ChangeLog-5.php#5.2.11
https://launchpad.net/ubuntu/lucid/+search?text=php5

deb
http://launchpadlibrarian.net/35315677/php5-common_5.2.11.dfsg.1-1ubuntu1_i386.deb
http://launchpadlibrarian.net/35315682/php5-cli_5.2.11.dfsg.1-1ubuntu1_i386.deb

http://launchpadlibrarian.net/35315690/php5-mysql_5.2.11.dfsg.1-1ubuntu1_i386.deb
http://launchpadlibrarian.net/35315701/php5_5.2.11.dfsg.1-1ubuntu1_all.deb
http://launchpadlibrarian.net/35315678/libapache2-mod-php5_5.2.11.dfsg.1-1ubuntu1_i386.deb
http://launchpadlibrarian.net/35315686/php5-gd_5.2.11.dfsg.1-1ubuntu1_i386.deb



Apache 2.2.14
http://www.apache.org/dist/httpd/CHANGES_2.2.14
https://launchpad.net/ubuntu/lucid/+search?text=apache2

deb
http://launchpadlibrarian.net/35592496/apache2_2.2.14-2ubuntu1_i386.deb
http://launchpadlibrarian.net/35592490/apache2-mpm-prefork_2.2.14-2ubuntu1_i386.deb
http://launchpadlibrarian.net/35592487/apache2.2-common_2.2.14-2ubuntu1_i386.deb
http://launchpadlibrarian.net/35592488/apache2.2-bin_2.2.14-2ubuntu1_i386.deb
http://launchpadlibrarian.net/35592493/apache2-utils_2.2.14-2ubuntu1_i386.deb

2009年9月21日月曜日

Ubuntu + Apache + PHP + Zend Framework

Ubuntu 9.04 + Zend Framework 1.9.2

Zend Framework
http://framework.zend.com/
から最新版を落とさず、deb packageを使う場合。

最新版を検索
https://launchpad.net/ubuntu/karmic/+search?text=zend

i386の場合
http://launchpadlibrarian.net/32316040/zend-framework-bin_1.9.3PL1-0ubuntu1_all.deb
http://launchpadlibrarian.net/32316041/zend-framework_1.9.3PL1-0ubuntu1_all.deb
http://launchpadlibrarian.net/32316039/libzend-framework-php_1.9.3PL1-0ubuntu1_all.deb
を落とす。

sudo dpkg -i *.deb
でinstall。Zend Frameworkは
/usr/share/php/libzend-

sudo vi /etc/php5/apache2/php.ini
;include_path = ".:/usr/share/php"

include_path = ".:/usr/share/php:/usr/share/php/libzend-framework-php"
に変更する。
或いは
/usr/share/php$ sudo ln -s libzend-framework-php/Zend


sudo /etc/init.d/apache2 restart
或いはreloadでいいかも。

include_pathを通さないと
http://framework.zend.com/docs/quickstart/create-your-project
zf create project quickstart
で作られた
quickstart/public/index.php
内のincludeでerrorになる。

libzend-framework-php/ directoryはいらないような気がする。

Install Tutorial: Ubuntu 9.04, Apache with SSL, Subversion over HTTP / HTTPs, and Trac 改

元ネタ或いは大いに参照すべきもの
Install Tutorial: Ubuntu 9.04, Apache with SSL, Subversion over HTTP / HTTPs, and Trac - NewInstance

より詳しい最新(Ubuntu9.10)の手順は
axis of evil Google: Install Tutorial: Ubuntu 9.10, Apache with SSL, Subversion over HTTP / HTTPs(digest authentication), and Trac
http://salvan-devmemo.blogspot.com/2010/01/install-tutorial-ubuntu-910-apache-with.html


冒頭のURLの手順から
-/etc/apache2/mods-available/dav_svn.conf
-/etc/apache2/sites-available/default
AuthTypeをBasicからDigestに変更し、passwordの生成はhtpasswdからhtdigestに変更する。引数は同じuser名の前にrealmを入れる。
hashの方式の違いからpasswordが変わるので別のfile名にする場合はAuthUserFileのpathも変える。
/etc/apache2/sites-available/defaultの末尾につけたtrac用の情報を/etc/apache2/sites-available/default-sslにも貼り付ける。
sudo a2enmod auth_digest
でdigest認証moduleを動かし、apacheを再起動する。


Firefox + HttpFox或いはWireshark等で認証がBasicからDigestになっている事を確認する。


Upgrading to 2.2 from 2.0 - Apache HTTP Server
The directive AuthDigestFile from mod_auth_digest has been merged with AuthUserFile and is now part of mod_authn_file.
という事でAuthUserFileをAuthDigestFileにする必要はない。


変更前
app 認証 ssl
subversion basic o
trac basic x

変更後
app 認証 ssl
subversion digest o
trac digest o

参考
core - Apache HTTP Server
Digest認証 - Wikipedia
Basic認証 - Wikipedia


関連
The Trac Project