設定ファイルは以下にある。
/etc/apache2/apache2.conf
以下をInclude
している。
/etc/apache2/mods-enabled/*.load/etc/apache2/mods-enabled/*.conf/etc/apache2/conf.d/*/etc/apache2/site-enabled/*
(Ubuntu 12.04 Server, 13.04 Server で確認)
設定ファイルは以下にある。
/etc/apache2/httpd.conf
※このファイルの実体は以下にある。
/private/etc/apache2/httpd.conf
以下をInclude
している。
/etc/apache2/other/*.conf
(OS X 10.6 で確認)
RailsなどWEBrickを動かす場合で、80番ポートでWEBrickにアクセスできるようにするには、Apacheにリバースプロキシを設定すると簡単。passengerを入れるほどでもない場合に。
https://github.com/gitlabhq/gitlab-recipes/blob/master/apache/gitlab
Apacheの VirtualHost の設定の中に以下のように書く。
ProxyPass / http://127.0.0.1:3000/ProxyPassReverse / http://127.0.0.1:3000/ProxyPreserveHost On
.htaccess
ファイル.htaccess
の設定2013/04/24RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule (.*) index.php/$1 [L]
.htaccess
の設定2013/12/21例
Satisfy AnyAuthUserFile /var/www/.htpasswdAuthGroupFile /dev/nullAuthName "secret area"AuthType Basicrequire valid-userSetEnvIf Request_URI /welcome.html excludeauthOrder deny,allowDeny from allAllow from env=excludeauth
BASIC認証をかけつつ、SetEnfIf
で特定のURLのときに変数を設定して、Allow
でその変数が設定されているときのアクセスを許可する。Satisfy Any
の指定は前半のrequire
の設定と後半のAllow
の設定のいずれかが満たされれば、アクセスが許可される、という意味。
.htaccess
の設定2013/04/09例
Satisfy AnyAuthUserFile /path/to/.htpasswdAuthGroupFile /dev/nullAuthName "hoge"AuthType Basicrequire valid-userOrder deny,allowAllow from 99.99.99.99Deny from all
.htaccess
の設定2013/12/21.htaccess
のRewriteEngine On
の直後に以下を書く。
RewriteEngine onRewriteCond %{REQUEST_URI} !^.*\.(js|css|gif|png|jpg)$RewriteCond %{REQUEST_URI} !/maintenance\.html$RewriteRule ^(.*) /maintenance.html [R,L]
メンテナンスが終わった後は、上記のRewriteEngine On
以外の3行を消して、代わりに以下を書く。
RewriteRule ^maintenance.html$ / [R,L]
.htaccess
2013/04/23RewriteEngine onRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)\.html /$1.php
$ ps aux | openssl md5 > rand.dat$ openssl genrsa -rand rand.dat -des3 2048 > 2012key.pem33 semi-random bytes loadedGenerating RSA private key, 1024 bit long modulus.............................++++++.......++++++e is 65537 (0x10001)Enter pass phrase:Verifying - Enter pass phrase:$ openssl req -new -key 2012key.pem -out 2012csr.pemEnter pass phrase for 2012key.pem:You are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [AU]:JPState or Province Name (full name) [Some-State]:TokyoLocality Name (eg, city) []:Shibuya-kuOrganization Name (eg, company) [Internet Widgits Pty Ltd]:Example Inc.Organizational Unit Name (eg, section) []:Common Name (eg, YOUR name) []:www.example.comEmail Address []:←入力しないPlease enter the following 'extra' attributesto be sent with your certificate requestA challenge password []:←入力しないAn optional company name []:←入力しない$ openssl rsa -in 2012key.pem -out 2012key-nopass.pemEnter pass phrase for 2012key.pem:writing RSA key$ cat 2012key.pem-----BEGIN RSA PRIVATE KEY-----Proc-Type: 4,ENCRYPTEDDEK-Info: DES-EDE3-CBC,9B527A3154370DC3MfBHRtPNOcpsvS/v8iROQiKI0OxkG/BDjgms5UcK8lZ0bVbWh+4pPM5k+cIs16b1...S3JLM5rJYiDqD68w+v1nr02eQ29eL4o8wosJJvILs5uGfe9/IbGY0g==-----END RSA PRIVATE KEY-----$ cat 2012key-nopass.pem-----BEGIN RSA PRIVATE KEY-----MIICXQIBAAKBgQDHJclRL5NKhmu6A3trgZJY6ZoRQfrjWcnhbxTNDRjS0sQHib/O...WxeCZcn78PNkRhnzV18rmniW7ey3GZt3NfDoGSP+4Gml-----END RSA PRIVATE KEY-----$ cat 2012csr.pem-----BEGIN CERTIFICATE REQUEST-----MIIBpzCCARACAQAwZzELMAkGA1UEBhMCSlAxDjAMBgNVBAgTBVRva3lvMRMwEQYD...EAUvkvx4rxqGKbYSr1fyPGWrTU+JSjEAlqz1QU4HPgrL1639qMroMggf8A==-----END CERTIFICATE REQUEST-----