CacheIgnoreCacheControl On
CacheIgnoreNoLastMod On
CacheIgnoreHeaders Set-Cookie
CacheEnable disk /
CacheRoot /var/cache/mod_cache
#CacheLock On
#CacheLockMaxAge 15
#CacheLockPath /tmp/mod_cache
WordPressが一番上の階層に設置してあるなど、Webサイト全体でキャッシュが有効でよかったら、CacheEnable disk / で。WordPressがあるディレクトリの下に設置してあるなどの場合は、CacheEnable disk /blog など、パスを指定。
wget http://jp2.php.net/get/php-7.0.4.tar.xz/from/this/mirror -O php-7.0.4.tar.xz
xz -d php-7.0.4.tar.xz
tar -xf php-7.0.4.tar
cd php-7.0.4
./configure --with-apxs2 --prefix=/usr/local/php/7.0.4 --以下-オプションは-お好みで
make
make install
make install すると、最初にインストールしてある方の /etc/httpd/conf/httpd.conf が書き換えられてしまうので、LoadModule が追加されていたらコメントアウトする。
AuthName "Please enter your ID and password"
AuthType Basic
AuthBasicProvider ldap file
AuthLDAPBindAuthoritative on
AuthLDAPUrl "ldap://192.168.xxx.xxx:389/ou=softel,dc=softel,dc=local?sAMAccountName?sub?(objectClass=*)"
AuthLDAPBindDN xxxxxxxx@softel-domain
AuthLDAPBindPassword "xxxxxxxx"
Require ldap-attribute objectClass=person
AuthUserFile /home/www/xxxx/yyyy/.htpasswd
AuthGroupFile /dev/null
Require valid-user
● LDAPして、ダメだったときは.htpasswdするけど社内IPはベーシック認証不要にする場合
AuthName "Please enter your ID and password"
AuthType Basic
AuthBasicProvider ldap file
AuthLDAPBindAuthoritative on
AuthLDAPUrl "ldap://192.168.xxx.xxx:389/ou=softel,dc=softel,dc=local?sAMAccountName?sub?(objectClass=*)"
AuthLDAPBindDN xxxxxxxx@softel-domain
AuthLDAPBindPassword "xxxxxxxx"
Require ldap-attribute objectClass=person
AuthUserFile /home/www/xxxx/yyyy/.htpasswd
AuthGroupFile /dev/null
Require valid-user
Satisfy Any
Order Allow,Deny
Allow from 123.456.789.000
HTMLファイルや画像ファイルのURLに、PUTリクエストを送ると、405 Method Not Allowed になるのですが、そういうものなのですか?
$ curl http://localhost/test/index.html -X PUT
$ curl http://localhost/readme.txt -X DELETE
→ 405 Method Not Allowed
答え
特に指定がない場合、デフォルトのハンドラー(default_handler())が処理しますが、apacheのソースを見ると、default_handler()は、GETメソッドとPOSTメソッド(とOPTIONS)以外は、HTTP_METHOD_NOT_ALLOWED(405 Method Not Allowed)か HTTP_NOT_IMPLEMENTED(501 Not Implemented)を返しています。
phpのハンドラーなど、PUTメソッドでもHOGEメソッドでも受け付けるハンドラーに処理させる設定になっていればまた結果が違いますが、デフォルトのハンドラーが処理すれば 405 Method Not Allowed などになります。
$ curl http://localhost/test/index.php -X HOGEHOGE
→ 200 OK でレスポンスが返ってくるし、php側でHOGEHOGEメソッドだった場合の処理を書くこともできる
PUTやDELEETで 405 Method Not Allowed にしたくない、どこかしらで処理をしたいのであれば、
Scriptディレクティブで設定するのが簡単です。
$ apachectl -t
httpd: apr_sockaddr_info_get() failed for xxxxxxxx
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Syntax OK
Order Deny,Allow
Deny from all
Allow from xxx.xxx.xxx
AuthType Basic
AuthUserFile /var/www/example.com/.htpasswd
AuthName "auth"
require valid-user
Satisfy any
# certbot certonly --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error in checking parameter list:
The apache plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError('Apache is unable to check whether or not the module is loaded because Apache is misconfigured.')
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
Options: -n: Not interactive --webroot: Place files in the document root of an already running server -w: The document root (where to place the files) -d: The domain -d: Another domain