#author("2018-10-21T21:37:50+09:00","","") [[Linux]] #shadowheader(1,目次); #contents * インストール,Install [#r0e8ed57] ** CentOS 6 [#z0c3a392] - apache のインストール yum install httpd - php のインストール yum install php-common php-mbstring - ssl(https 認証)系のインストール yum install openssl mod_ssl * .htaccess による制御方法 [#b323294f] ** 作成 [#g10c0a63] AuthUserFile /var/honya/honya/.htpasswd AuthGroupFile /dev/null AuthName "Please Input! UserName & Password(^^)" AuthType Basic require valid-user ** .htaccess が有効にならない [#ia3ce135] - <Directory /> の設定を確認する。~ 同様に Indexes も有効にならない時がある。 <Directory /> AllowOverride All Options Indexes FollowSymLinks </Directory> *htpasswd [#u99d8e15] +最初の1人目 htpasswd -c /var/honya/honya/.htpasswd (username) +2人目以降 htpasswd /var/honya/honya/.htpasswd (username) *apache が作成するファイルの umask を変更する。 [#w7bb7fcb] echo "umask 002" >> /etc/sysconfig/httpd /etc/init.d/httpd restart *Ubuntu(debian)系、apache実行ユーザー [#idf7c4d7] -下記に記述あり /etc/apache2/envvars * RewriteEngine が有効にならない時 [#m6a9ac35] - Options に FollowSymLinks があることを確認する * redirect(url の転送) [#h3f1a8a9] ** httpd.conf による転送 [#xbb2b317] - 例) ルートディレクトリを転送する http://tar3.net/ -> https://www.tar3.net/ -- vi /etc/httpd/conf/httpd.conf <Directory /> # Options FollowSymLinks # AllowOverride None Redirect / https://www.tar3.net/ </Directory> ** htmlでリダイレクト [#ef631d1f] -vim index.html <meta http-equiv="refresh" content="0; URL='http://new-website.com'" /> * チューニング [#t75af9bd] ** 参考サイト [#je3d6352] - [[中規模サイトのApacheチューニング(qiita):https://qiita.com/kou/items/acb3dcf1dcb428d7a3ec]] - [[Apacheチューニング方法(Apache2.4, prefork)(qiita):https://qiita.com/takahashi-kazuki/items/2352aec16d6a1dc40582]] ** 前提 [#n05c5377] - CentOS6 を使用(RedHat clone) ** mpm 関連設定 [#h2d846a5] - sudo vi /etc/httpd/conf/httpd.conf - 自分はこんな感じ <IfModule prefork.c> StartServers 10 MinSpareServers 10 MaxSpareServers 10 ServerLimit 100 MaxClients 100 MaxRequestsPerChild 1000 </IfModule> - 上から3つ(Start, Min, Max)見たとおり。子プロセスの数。 - 次のLimit と Max は同時接続数。 − 一番下のMaxリクエストは、いくつリクエストを処理したら~ httpd のSpareServerを作りなおすか。 ** Timeout, KeepAlive [#f0bd34e2] - sudo vi /etc/httpd/conf/httpd.conf - Timeout のデフォルト300秒は長すぎ。もっと短くする。 - KeepAlive はオフにする。 Timeout 60 KeepAlive Off ** logファイル関連。 [#rcd2793a] - sudo vi /etc/httpd/conf/httpd.conf - HostnameLookups をオフにする。 HostnameLookups Off