#author("2019-02-23T15:01:31+09:00","default:dramsukohome","dramsukohome")
[[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




* Log解析 [#qb8947bd]



** Visitors [#w7c80827]
-Visitors(外部)
--[[Visitorsのインストール(外部):http://ja.528p.com/linux/centos6/SM006-visitors.html]]
--[[Visitorsの公式サイト:http://www.hping.org/visitors/]]



** Webalizer [#j0659d04]


*** Link [#hb1c86be]


*** Install [#y66940e3]


*** 設定 [#d10d0e30]


*** 過去ログの取り込み [#p029cbc5]

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS