SlideShare una empresa de Scribd logo
1 de 70
Descargar para leer sin conexión
Nginx,	 MySQL	 Replication…	 
WordPress	 
	 サーバの運用 (構築編)
WordCamp	 Kansai	 2014
OKAMOTO
Wataru
@wokamoto
Wckansai 2014
WordPress	 Server
*	 WordPress	 運用時の最小構成	 
*	 Web	 サーバを	 Apache	 から	 Nginx	 に

*	 CDN	 の導入	 
*	 Web	 サーバを冗長化
*	 DB	 サーバを冗長化
Menu	 for	 Today
Minimum	 
Configuration
WordPress	 運用時の最小構成
Minimum	 Configuration
*Apache	 (	 mod_rewrite	 )	 
!
*php	 	 	 5.2.4	 or	 higher	 
!
*MySQL	 5.0	 or	 higher
<ifModule	
  mod_expires.c>	
  
ExpiresActive	
  On	
  
ExpiresDefault	
  "access	
  plus	
  1	
  seconds"	
  
ExpiresByType	
  text/html	
  "access	
  plus	
  1	
  seconds"	
  
ExpiresByType	
  image/gif	
  "access	
  plus	
  30	
  days"	
  
ExpiresByType	
  image/jpeg	
  "access	
  plus	
  30	
  days"	
  
ExpiresByType	
  image/png	
  "access	
  plus	
  30	
  days"	
  
ExpiresByType	
  text/css	
  "access	
  plus	
  30	
  days"	
  
ExpiresByType	
  text/javascript	
  "access	
  plus	
  30	
  days"	
  
ExpiresByType	
  application/x-­‐javascript	
  "access	
  plus	
  30	
  days"	
  
ExpiresByType	
  application/x-­‐shockwave-­‐flash	
  "access	
  plus	
  30	
  days"	
  
</ifModule>
有効期限の設定
Minimum	 Configuration
<link	
  rel="stylesheet"	
  type="text/css"	
  media=“all"	
  
	
  href="<?php	
  echo	
  get_stylesheet_uri();	
  ?>	
  
?ver=<?php	
  echo	
  filemtime(get_stylesheet_directory()	
  .	
  '/style.css');	
  ?>"	
  />
キャッシュのコントロール
add_filter('stylesheet_uri',	
  function($stylesheet_uri){	
  
	
  	
  $stylesheet	
  =	
  get_stylesheet_directory()	
  .	
  '/style.css';	
  
	
  	
  $stylesheet_uri	
  .=	
  '?ver='	
  .	
  filemtime($stylesheet);	
  
	
  	
  return	
  $stylesheet_uri;	
  
});
または
Minimum	 Configuration
<IfModule	
  mod_deflate.c>	
  
SetOutputFilter	
  DEFLATE	
  
BrowserMatch	
  ^Mozilla/4	
  gzip-­‐only-­‐text/html	
  
BrowserMatch	
  ^Mozilla/4.0[678]	
  no-­‐gzip	
  
BrowserMatch	
  bMSI[E]	
  !no-­‐gzip	
  !gzip-­‐only-­‐text/html	
  
SetEnvIfNoCase	
  Request_URI	
  .(?:gif|jpe?g|png|ico)$	
  no-­‐gzip	
  dont-­‐vary	
  
SetEnvIfNoCase	
  Request_URI	
  _.utxt$	
  no-­‐gzip	
  
#DeflateCompressionLevel	
  4	
  
AddOutputFilterByType	
  DEFLATE	
  text/plain	
  
AddOutputFilterByType	
  DEFLATE	
  text/html	
  
AddOutputFilterByType	
  DEFLATE	
  text/xml	
  
AddOutputFilterByType	
  DEFLATE	
  text/css	
  
AddOutputFilterByType	
  DEFLATE	
  application/xml	
  
AddOutputFilterByType	
  DEFLATE	
  application/x-­‐javascript	
  
AddOutputFilterByType	
  DEFLATE	
  application/x-­‐httpd-­‐php	
  
</IfModule>
圧縮転送の設定
Minimum	 Configuration
#	
  BEGIN	
  WordPress	
  
<IfModule	
  mod_rewrite.c>	
  
RewriteEngine	
  On	
  
RewriteBase	
  /	
  
RewriteCond	
  %{REQUEST_FILENAME}	
  !-­‐f	
  
RewriteCond	
  %{REQUEST_FILENAME}	
  !-­‐d	
  
RewriteRule	
  .	
  /index.php	
  [L]	
  
</IfModule>	
  
	
  	
  
#	
  END	
  WordPress	
  
カスタムパーマリンクの設定
Minimum	 Configuration
#	
  BEGIN	
  WordPress	
  
<IfModule	
  mod_rewrite.c>	
  
RewriteEngine	
  On	
  
RewriteBase	
  /	
  
RewriteCond	
  %{REQUEST_FILENAME}	
  !.(js|css|jpe?g|png|gif|ico)$	
  
RewriteCond	
  %{REQUEST_FILENAME}	
  !-­‐f	
  
RewriteCond	
  %{REQUEST_FILENAME}	
  !-­‐d	
  
RewriteRule	
  .	
  /index.php	
  [L]	
  
</IfModule>	
  
	
  	
  
#	
  END	
  WordPress	
  
Minimum	 Configuration
カスタムパーマリンクの設定
.htaceess 使ったら、
負けだと思っている
.htaceess は、極力使わない
Minimum	 Configuration
/usr/share/mysql	
  
	
  my-­‐innodb-­‐heavy-­‐4G.cnf	
  	
  InnoDB	
  memory	
  4G	
  
	
  my-­‐huge.cnf	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  memory	
  1G	
  -­‐	
  2G	
  
	
  my-­‐large.cnf	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  memory	
  -­‐	
  512MB	
  
	
  my-­‐medium.cnf	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  memory	
  -­‐	
  128MB	
  
	
  my-­‐small.cnf	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  memory	
  -­‐	
  64MB	
  
MySQL	 のチューニング
Minimum	 Configuration
$	
  wget	
  -­‐O	
  -­‐	
  mysqltuner.pl	
  |	
  perl	
  


	
  >>	
  	
  MySQLTuner	
  1.3.0	
  -­‐	
  Major	
  Hayden	
  <major
	
  >>	
  	
  Bug	
  reports,	
  feature	
  requests,	
  and	
  dow
	
  >>	
  	
  Run	
  with	
  '-­‐-­‐help'	
  for	
  additional	
  optio
[!!]	
  Successfully	
  authenticated	
  with	
  no	
  pas
[OK]	
  Currently	
  running	
  supported	
  MySQL	
  vers
[OK]	
  Operating	
  on	
  64-­‐bit	
  architecture	
  
!
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  Storage	
  Engine	
  Statistics	
  
Minimum	 Configuration
MySQL	 のチューニング
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  Storage	
  Engine	
  Statistics	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐
[-­‐-­‐]	
  Status:	
  +ARCHIVE	
  +BLACKHOLE	
  +CSV	
  -­‐FEDERATED	
  +I
[-­‐-­‐]	
  Data	
  in	
  InnoDB	
  tables:	
  496K	
  (Tables:	
  12)	
  
[-­‐-­‐]	
  Data	
  in	
  PERFORMANCE_SCHEMA	
  tables:	
  0B	
  (Tables:
[OK]	
  Total	
  fragmented	
  tables:	
  0
Minimum	 Configuration
MySQL	 のチューニング
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  Security	
  Recommendations	
  	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐
[!!]	
  User	
  '@localhost'	
  has	
  no	
  password	
  set.	
  
[!!]	
  User	
  '@v210-­‐172-­‐187-­‐188.z0d1.static.cnode.jp'	
  
[!!]	
  User	
  'root@127.0.0.1'	
  has	
  no	
  password	
  set.	
  
[!!]	
  User	
  'root@::1'	
  has	
  no	
  password	
  set.	
  
[!!]	
  User	
  'root@localhost'	
  has	
  no	
  password	
  set.	
  
[!!]	
  User	
  'root@v210-­‐172-­‐187-­‐188.z0d1.static.cnode.
Minimum	 Configuration
MySQL	 のチューニング
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  Performance	
  Metrics	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐
[-­‐-­‐]	
  Up	
  for:	
  5h	
  5m	
  4s	
  (111	
  q	
  [0.006	
  qps],	
  8	
  conn,	
  T
[-­‐-­‐]	
  Reads	
  /	
  Writes:	
  96%	
  /	
  4%	
  
[-­‐-­‐]	
  Total	
  buffers:	
  232.0M	
  global	
  +	
  1.5M	
  per	
  thread
[OK]	
  Maximum	
  possible	
  memory	
  usage:	
  424.0M	
  (2%	
  of	
  i
[OK]	
  Slow	
  queries:	
  0%	
  (0/111)	
  
[OK]	
  Highest	
  usage	
  of	
  available	
  connections:	
  0%	
  (1/
[OK]	
  Key	
  buffer	
  size	
  /	
  total	
  MyISAM	
  indexes:	
  16.0M/
[OK]	
  Query	
  cache	
  efficiency:	
  41.3%	
  (38	
  cached	
  /	
  92	
  
[OK]	
  Query	
  cache	
  prunes	
  per	
  day:	
  0	
  
[OK]	
  Sorts	
  requiring	
  temporary	
  tables:	
  0%	
  (0	
  temp	
  s
Minimum	 Configuration
MySQL	 のチューニング
-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐	
  Recommendations	
  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐
General	
  recommendations:	
  
	
  	
  	
  	
  MySQL	
  started	
  within	
  last	
  24	
  hours	
  -­‐	
  recommenda
	
  	
  	
  	
  Enable	
  the	
  slow	
  query	
  log	
  to	
  troubleshoot	
  bad	
  q
	
  	
  	
  	
  When	
  making	
  adjustments,	
  make	
  tmp_table_size/ma
	
  	
  	
  	
  Reduce	
  your	
  SELECT	
  DISTINCT	
  queries	
  without	
  LIM
Variables	
  to	
  adjust:	
  
	
  	
  	
  	
  tmp_table_size	
  (>	
  64M)	
  
	
  	
  	
  	
  max_heap_table_size	
  (>	
  64M)	
  
!
Minimum	 Configuration
MySQL	 のチューニング
Nginx
Web	 サーバを	 Apache	 から	 Nginx	 に
Nginx	 ?
*	 OSS	 の軽量	 HTTP	 サーバ	 
!
!
*	 スレッドモデルでは無く、イベントループモデルを採用	 
!
!
*	 トラフィック量上位100万サイトでのシェア20%
Nginx	 ?
*	 OSS	 の軽量	 HTTP	 サーバ	 
!
!
*	 スレッドモデルでは無く、イベントループモデルを採用	 
!
!
*	 トラフィック量上位100万サイトでのシェア20%
Nginx	 ?
*	 OSS	 の軽量	 HTTP	 サーバ	 
!
!
*	 スレッドモデルでは無く、イベントループモデルを採用	 
!
!
*	 トラフィック量上位100万サイトでのシェア20%
Nginx	 ?
WordPres.com	 でも採用
$	
  wget	
  -­‐S	
  -­‐-­‐spider	
  http://wordpress.com	
  
wordpress.com|66.155.11.243|:80	
  に接続しています...	
  接続しました。	
  
HTTP	
  による接続要求を送信しました、応答を待っています...	
  	
  
	
  	
  HTTP/1.1	
  200	
  OK	
  
	
  	
  Server:	
  nginx	
  
	
  	
  Date:	
  Tue,	
  15	
  Apr	
  2014	
  05:58:07	
  GMT	
  
	
  	
  Content-­‐Type:	
  text/html;	
  charset=utf-­‐8	
  
	
  	
  Connection:	
  keep-­‐alive	
  
	
  	
  Vary:	
  Accept-­‐Encoding	
  
	
  	
  X-­‐Frame-­‐Options:	
  SAMEORIGIN	
  
	
  	
  Vary:	
  Cookie	
  
	
  	
  Set-­‐Cookie:	
  wordpress_homepage=existing;	
  expires=Wed,	
  30-­‐Apr-­‐2014	
  
05:58:07	
  GMT	
  
Nginx	 ?
PHP	 は	 fast-CGI	 で
Apache の mod_php のように Web サーバと同一プロセ
スで php を動作させることはできません。!
!
php-fpm などを使って別プロセスで動作させる必要があり
ます。!
Nginx	 ?
Nginx	 +	 php-fpm
nginx.conf	 の例
server	
  {	
  
	
  	
  listen	
  	
  	
  	
  	
  	
  80	
  default;	
  
	
  	
  server_name	
  _;	
  
	
  	
  root	
  	
  	
  	
  	
  	
  	
  	
  /path/to/app;	
  
	
  	
  index	
  	
  	
  	
  	
  	
  	
  index.php	
  index.html	
  index.htm;	
  
	
  	
  charset	
  	
  	
  	
  	
  utf-­‐8;	
  
!
	
  	
  location	
  ~	
  .php$	
  {	
  
	
  	
  	
  	
  fastcgi_pass	
  	
  	
  unix:/var/run/php-­‐fpm.sock;	
  
	
  	
  	
  	
  fastcgi_index	
  	
  index.php;	
  
	
  	
  	
  	
  fastcgi_param	
  SCRIPT_FILENAME	
  
Nginx	 +	 php-fpm
php-fpm.conf	 の例
[www]	
  
listen	
  =	
  /var/run/php-­‐fpm.sock	
  
listen.owner	
  =	
  nginx	
  
listen.group	
  =	
  nginx	
  
listen.mode	
  =	
  0666	
  
!
user	
  =	
  nginx	
  
group	
  =	
  nginx	
  
!
pm	
  =	
  dynamic	
  
pm.max_children	
  =	
  15	
  
pm.start_servers	
  =	
  5	
  
Nginx	 +	 php-fpm
Nginx	 
Performance
Nginx	 Reverse	 Proxy	 Cache	 の紹介
Nginx	 Performance
Apache,	 mod_php,	 WordPress
ab -n 100 -c 10 (WordPress トップページ)!
!
* Requests per second: 4.26 [#/sec]!
!
* Time per request: 2346.174 [ms]!
!
* Connection Times Total: 2309 [ms]
Nginx	 Performance
Apache,	 mod_php,	 WordPress
Nginx	 Performance
Nginx,	 php-fpm,	 WordPress
ab -n 100 -c 10 (WordPress トップページ)!
!
* Requests per second: 5.79 [#/sec]!
!
* Time per request: 1726.535 [ms]!
!
* Connection Times Total: 1617 [ms]
Nginx	 Performance
Nginx,	 php-fpm,	 WordPress
Nginx	 Performance
Reverse	 Proxy	 Cache	 
!
!
ab -n 100 -c 10 (WordPress トップページ)!
!
* Requests per second: 141.24 [#/sec]!
!
* Time per request: 708.007 [ms]!
!
* Connection Times Total: 636 [ms]
Nginx	 Performance
Nginx	 Reverse	 Proxy	 Cache,	 WordPress
Nginx	 
Reverse	 Proxy	 Cache
nginx.conf	 の例
http	
  {	
  
	
  	
  	
  	
  	
  	
  :	
  
	
  	
  proxy_cache_path	
  	
  /var/cache/nginx/proxy_cache	
  levels=1:2	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  keys_zone=czone:32m	
  max_size=256m	
  inactive=1440m;	
  
	
  	
  proxy_temp_path	
  	
  	
  /var/cache/nginx/proxy_temp;	
  
	
  	
  proxy_cache_key	
  	
  	
  "$scheme://$host$request_uri";	
  
	
  	
  proxy_set_header	
  	
  Host	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  $host;	
  
	
  	
  proxy_set_header	
  	
  Remote-­‐Addr	
  	
  	
  	
  	
  	
  	
  	
  $remote_addr;	
  
	
  	
  proxy_set_header	
  	
  X-­‐Forwarded-­‐Host	
  	
  	
  $host;	
  
	
  	
  proxy_set_header	
  	
  X-­‐Forwarded-­‐Server	
  $host;	
  
	
  	
  proxy_set_header	
  	
  X-­‐Forwarded-­‐For	
  	
  	
  	
  $proxy_add_x_forwarded_for;	
  
!
	
  	
  upstream	
  backend	
  {	
  
	
  	
  	
  	
  server	
  unix:/var/run/nginx-­‐backend.sock;	
  
	
  	
  }	
  
	
  	
  	
  	
  	
  	
  :	
  
}
Reverse	 Proxy	 Cache
http	
  {	
  
	
  	
  	
  	
  	
  	
  :	
  
	
  	
  proxy_cache_path	
  	
  /var/cache/nginx/proxy_cache	
  levels=1:2	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  keys_zone=czone:32m	
  max_size=256m	
  inactive=1440m;	
  
	
  	
  proxy_temp_path	
  	
  	
  /var/cache/nginx/proxy_temp;	
  
	
  	
  proxy_cache_key	
  	
  	
  "$scheme://$host$request_uri";	
  
	
  	
  proxy_set_header	
  	
  Host	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  $host;	
  
	
  	
  proxy_set_header	
  	
  Remote-­‐Addr	
  	
  	
  	
  	
  	
  	
  	
  $remote_addr;	
  
	
  	
  proxy_set_header	
  	
  X-­‐Forwarded-­‐Host	
  	
  	
  $host;	
  
	
  	
  proxy_set_header	
  	
  X-­‐Forwarded-­‐Server	
  $host;	
  
	
  	
  proxy_set_header	
  	
  X-­‐Forwarded-­‐For	
  	
  	
  	
  $proxy_add_x_forwarded_for;	
  
!
	
  	
  upstream	
  backend	
  {	
  
	
  	
  	
  	
  server	
  unix:/var/run/nginx-­‐backend.sock;	
  
	
  	
  }	
  
	
  	
  	
  	
  	
  	
  :	
  
}
Reverse	 Proxy	 Cache
nginx.conf	 の例
http	
  {	
  
	
  	
  	
  	
  	
  	
  :	
  
	
  	
  proxy_cache_path	
  	
  /var/cache/nginx/proxy_cache	
  levels=1:2	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  keys_zone=czone:32m	
  max_size=256m	
  inactive=1440m;	
  
	
  	
  proxy_temp_path	
  	
  	
  /var/cache/nginx/proxy_temp;	
  
	
  	
  proxy_cache_key	
  	
  	
  "$scheme://$host$request_uri";	
  
	
  	
  proxy_set_header	
  	
  Host	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  $host;	
  
	
  	
  proxy_set_header	
  	
  Remote-­‐Addr	
  	
  	
  	
  	
  	
  	
  	
  $remote_addr;	
  
	
  	
  proxy_set_header	
  	
  X-­‐Forwarded-­‐Host	
  	
  	
  $host;	
  
	
  	
  proxy_set_header	
  	
  X-­‐Forwarded-­‐Server	
  $host;	
  
	
  	
  proxy_set_header	
  	
  X-­‐Forwarded-­‐For	
  	
  	
  	
  $proxy_add_x_forwarded_for;	
  
!
	
  	
  upstream	
  backend	
  {	
  
	
  	
  	
  	
  server	
  unix:/var/run/nginx-­‐backend.sock;	
  
	
  	
  }	
  
	
  	
  	
  	
  	
  	
  :	
  
}
Reverse	 Proxy	 Cache
nginx.conf	 の例
http	
  {	
  
	
  	
  	
  	
  	
  	
  :	
  
	
  	
  proxy_cache_path	
  	
  /var/cache/nginx/proxy_cache	
  levels=1:2	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  keys_zone=czone:32m	
  max_size=256m	
  inactive=1440m;	
  
	
  	
  proxy_temp_path	
  	
  	
  /var/cache/nginx/proxy_temp;	
  
	
  	
  proxy_cache_key	
  	
  	
  "$scheme://$host$request_uri";	
  
	
  	
  proxy_set_header	
  	
  Host	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  $host;	
  
	
  	
  proxy_set_header	
  	
  Remote-­‐Addr	
  	
  	
  	
  	
  	
  	
  	
  $remote_addr;	
  
	
  	
  proxy_set_header	
  	
  X-­‐Forwarded-­‐Host	
  	
  	
  $host;	
  
	
  	
  proxy_set_header	
  	
  X-­‐Forwarded-­‐Server	
  $host;	
  
	
  	
  proxy_set_header	
  	
  X-­‐Forwarded-­‐For	
  	
  	
  	
  $proxy_add_x_forwarded_for;	
  
!
	
  	
  upstream	
  backend	
  {	
  
	
  	
  	
  	
  server	
  unix:/var/run/nginx-­‐backend.sock;	
  
	
  	
  }	
  
	
  	
  	
  	
  	
  	
  :	
  
}
Reverse	 Proxy	 Cache
nginx.conf	 の例
server	
  {	
  
	
  	
  listen	
  	
  	
  	
  	
  	
  80	
  default;	
  
	
  	
  server_name	
  _;	
  
	
  	
  root	
  	
  	
  	
  	
  	
  	
  	
  /path/to/wordpress;	
  
	
  	
  index	
  	
  	
  	
  	
  	
  	
  index.php	
  index.html	
  index.htm;	
  
!
	
  	
  location	
  ~*	
  .(js|css|jpe?g|gif|png|swf|wmv|flv|ico)$	
  {	
  
	
  	
  	
  	
  expires	
  30d;	
  
	
  	
  }	
  
!
	
  	
  location	
  /	
  {	
  
	
  	
  	
  	
  set	
  $do_not_cache	
  0;	
  
	
  	
  	
  	
  if	
  ($request_method	
  =	
  POST)	
  {	
  
	
  	
  	
  	
  	
  	
  set	
  $do_not_cache	
  1;	
  
	
  	
  	
  	
  }	
  
	
  	
  	
  	
  proxy_no_cache	
  	
  	
  	
  	
  $do_not_cache;	
  
	
  	
  	
  	
  proxy_cache_bypass	
  $do_not_cache;	
  
	
  	
  	
  	
  proxy_redirect	
  	
  	
  	
  	
  off;	
  
	
  	
  	
  	
  proxy_cache	
  	
  	
  	
  	
  	
  	
  	
  czone;	
  
	
  	
  	
  	
  proxy_cache_key	
  	
  	
  	
  "$scheme://$host$request_uri";	
  
	
  	
  	
  	
  proxy_cache_valid	
  	
  200	
  0m;	
  
	
  	
  	
  	
  proxy_pass	
  http://backend;	
  
	
  	
  }	
  
}
server	
  {	
  
	
  	
  listen	
  	
  	
  	
  	
  	
  80	
  default;	
  
	
  	
  server_name	
  _;	
  
	
  	
  root	
  	
  	
  	
  	
  	
  	
  	
  /path/to/wordpress;	
  
	
  	
  index	
  	
  	
  	
  	
  	
  	
  index.php	
  index.html	
  index.htm;	
  
!
	
  	
  location	
  ~*	
  .(js|css|jpe?g|gif|png|swf|wmv|flv|ico)$	
  {	
  
	
  	
  	
  	
  expires	
  30d;	
  
	
  	
  }	
  
!
	
  	
  location	
  /	
  {	
  
	
  	
  	
  	
  set	
  $do_not_cache	
  0;	
  
	
  	
  	
  	
  if	
  ($request_method	
  =	
  POST)	
  {	
  
	
  	
  	
  	
  	
  	
  set	
  $do_not_cache	
  1;	
  
	
  	
  	
  	
  }	
  
	
  	
  	
  	
  proxy_no_cache	
  	
  	
  	
  	
  $do_not_cache;	
  
	
  	
  	
  	
  proxy_cache_bypass	
  $do_not_cache;	
  
	
  	
  	
  	
  proxy_redirect	
  	
  	
  	
  	
  off;	
  
	
  	
  	
  	
  proxy_cache	
  	
  	
  	
  	
  	
  	
  	
  czone;	
  
	
  	
  	
  	
  proxy_cache_key	
  	
  	
  	
  "$scheme://$host$request_uri";	
  
	
  	
  	
  	
  proxy_cache_valid	
  	
  200	
  0m;	
  
	
  	
  	
  	
  proxy_pass	
  http://backend;	
  
	
  	
  }	
  
}
server	
  {	
  
	
  	
  listen	
  	
  	
  	
  	
  	
  80	
  default;	
  
	
  	
  server_name	
  _;	
  
	
  	
  root	
  	
  	
  	
  	
  	
  	
  	
  /path/to/wordpress;	
  
	
  	
  index	
  	
  	
  	
  	
  	
  	
  index.php	
  index.html	
  index.htm;	
  
!
	
  	
  location	
  ~*	
  .(js|css|jpe?g|gif|png|swf|wmv|flv|ico)$	
  {	
  
	
  	
  	
  	
  expires	
  30d;	
  
	
  	
  }	
  
!
	
  	
  location	
  /	
  {	
  
	
  	
  	
  	
  set	
  $do_not_cache	
  0;	
  
	
  	
  	
  	
  if	
  ($request_method	
  =	
  POST)	
  {	
  
	
  	
  	
  	
  	
  	
  set	
  $do_not_cache	
  1;	
  
	
  	
  	
  	
  }	
  
	
  	
  	
  	
  proxy_no_cache	
  	
  	
  	
  	
  $do_not_cache;	
  
	
  	
  	
  	
  proxy_cache_bypass	
  $do_not_cache;	
  
	
  	
  	
  	
  proxy_redirect	
  	
  	
  	
  	
  off;	
  
	
  	
  	
  	
  proxy_cache	
  	
  	
  	
  	
  	
  	
  	
  czone;	
  
	
  	
  	
  	
  proxy_cache_key	
  	
  	
  	
  "$scheme://$host$request_uri";	
  
	
  	
  	
  	
  proxy_cache_valid	
  	
  200	
  0m;	
  
	
  	
  	
  	
  proxy_pass	
  http://backend;	
  
	
  	
  }	
  
}
server	
  {	
  
	
  	
  listen	
  	
  	
  	
  	
  	
  unix:/var/run/nginx-­‐backend.sock;	
  
	
  	
  server_name	
  _;	
  
	
  	
  root	
  	
  	
  	
  	
  	
  	
  	
  /path/to/wordpress;	
  
	
  	
  index	
  	
  	
  	
  	
  	
  	
  index.php	
  index.html	
  index.htm;	
  
	
  	
  charset	
  	
  	
  	
  	
  utf-­‐8;	
  
!
	
  	
  gzip	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  off;	
  
	
  	
  gzip_vary	
  	
  	
  	
  	
  	
  	
  	
  	
  off;	
  
!
	
  	
  location	
  ~	
  .php$	
  {	
  
	
  	
  	
  	
  fastcgi_pass	
  	
  	
  unix:/var/run/php-­‐fpm.sock;	
  
	
  	
  	
  	
  fastcgi_index	
  	
  index.php;	
  
	
  	
  	
  	
  fastcgi_param	
  	
  SCRIPT_FILENAME	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  $document_root$fastcgi_script_name;	
  
	
  	
  	
  	
  include	
  	
  	
  	
  	
  	
  	
  	
  fastcgi_params;	
  
	
  	
  	
  	
  fastcgi_pass_header	
  "X-­‐Accel-­‐Redirect";	
  
	
  	
  	
  	
  fastcgi_pass_header	
  "X-­‐Accel-­‐Buffering";	
  
	
  	
  	
  	
  fastcgi_pass_header	
  "X-­‐Accel-­‐Charset";	
  
	
  	
  	
  	
  fastcgi_pass_header	
  "X-­‐Accel-­‐Expires";	
  
	
  	
  	
  	
  fastcgi_pass_header	
  "X-­‐Accel-­‐Limit-­‐Rate";	
  
	
  	
  }	
  
}
server	
  {	
  
	
  	
  listen	
  	
  	
  	
  	
  	
  unix:/var/run/nginx-­‐backend.sock;	
  
	
  	
  server_name	
  _;	
  
	
  	
  root	
  	
  	
  	
  	
  	
  	
  	
  /path/to/app;	
  
	
  	
  index	
  	
  	
  	
  	
  	
  	
  index.php	
  index.html	
  index.htm;	
  
	
  	
  charset	
  	
  	
  	
  	
  utf-­‐8;	
  
!
	
  	
  gzip	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  off;	
  
	
  	
  gzip_vary	
  	
  	
  	
  	
  	
  	
  	
  	
  off;	
  
!
	
  	
  location	
  ~	
  .php$	
  {	
  
	
  	
  	
  	
  fastcgi_pass	
  	
  	
  unix:/var/run/php-­‐fpm.sock;	
  
	
  	
  	
  	
  fastcgi_index	
  	
  index.php;	
  
	
  	
  	
  	
  fastcgi_param	
  	
  SCRIPT_FILENAME	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  $document_root$fastcgi_script_name;	
  
	
  	
  	
  	
  include	
  	
  	
  	
  	
  	
  	
  	
  fastcgi_params;	
  
	
  	
  	
  	
  fastcgi_pass_header	
  "X-­‐Accel-­‐Redirect";	
  
	
  	
  	
  	
  fastcgi_pass_header	
  "X-­‐Accel-­‐Buffering";	
  
	
  	
  	
  	
  fastcgi_pass_header	
  "X-­‐Accel-­‐Charset";	
  
	
  	
  	
  	
  fastcgi_pass_header	
  "X-­‐Accel-­‐Expires";	
  
	
  	
  	
  	
  fastcgi_pass_header	
  "X-­‐Accel-­‐Limit-­‐Rate";	
  
	
  	
  }	
  
}
cache	 時間を	 php	 で制御
<?php	
  
header('X-­‐Accel-­‐Expires:	
  '.	
  60	
  *	
  60	
  *	
  24);	
  
?>
Reverse	 Proxy	 Cache
Reverse	 Proxy	 Cache
WP	 plugin	 Nginx	 Cache	 Controller	 -	 

	 https://wordpress.org/plugins/nginx-champuru/
Reverse	 Proxy	 Cache
WP	 plugin	 Nginx	 Mobile	 Theme	 -	 

	 https://wordpress.org/plugins/nginx-mobile-theme/
Contents	 Delivery	 
Network
CDN	 の導入
CDN
CDN	 (	 Contents	 Delivery	 Network	 )	 ?
CDNAkamai	 -	 	 
	 http://www.akamai.co.jp/enja/
CDN
CloudFront	 -	 

	 	 http://aws.amazon.com/jp/cloudfront/
CDN
CloudFlare	 -	 

	 	 https://www.cloudflare.com/
CDN
Jetpack	 Photon	 -	 

	 http://jetpack.me/support/photon/
wp-content/uploads 以下だけを cdn
から配信したい
CDN
WordPress	 で利用するには?
CDNWP	 plugin	 絡新婦	 -	 

	 http://wordpress.org/plugins/nephila-clavata/
CDN
S3	 ->	 CloudFront
CDN
オレオレ	 CDN
Redundant	 
	 Web	 servers
Web	 サーバを冗長化
Redundant	 Web	 servers
NFS	 で	 WordPress	 を共有
Redundant	 Web	 servers
Master	 /	 Slave	 形式に
server	
  {	
  
	
  	
  listen	
  	
  	
  	
  	
  	
  80	
  default;	
  
	
  	
  server_name	
  _;	
  
	
  	
  root	
  	
  	
  	
  	
  	
  	
  	
  /path/to/wordpress;	
  
	
  	
  index	
  	
  	
  	
  	
  	
  	
  index.php	
  index.html	
  index.htm;	
  
!
	
  	
  set	
  $backend	
  'http://127.0.0.1:8080';	
  
	
  	
  if	
  ($request_method	
  =	
  POST)	
  {	
  
	
  	
  	
  	
  set	
  $backend	
  'http://{master	
  server	
  IP}:8080';	
  
	
  	
  }	
  
!
	
  	
  location	
  /	
  {	
  
	
  	
  	
  	
  proxy_pass	
  	
  	
  	
  	
  	
  	
  	
  	
  $backend;	
  
	
  	
  }	
  
}	
  
Redundant	 Web	 servers
POST	 の場合のバックエンド変更
Redundant	 Web	 servers
server	
  {	
  
	
  	
  listen	
  	
  	
  	
  	
  	
  80	
  default;	
  
	
  	
  server_name	
  _;	
  
	
  	
  root	
  	
  	
  	
  	
  	
  	
  	
  /path/to/wordpress;	
  
	
  	
  index	
  	
  	
  	
  	
  	
  	
  index.php	
  index.html	
  index.htm;	
  
!
	
  	
  set	
  $backend	
  'http://127.0.0.1:8080';	
  
	
  	
  if	
  ($request_method	
  =	
  POST)	
  {	
  
	
  	
  	
  	
  set	
  $backend	
  'http://{master	
  server	
  IP}:8080';	
  
	
  	
  }	
  
!
	
  	
  location	
  /	
  {	
  
	
  	
  	
  	
  proxy_pass	
  	
  	
  	
  	
  	
  	
  	
  	
  $backend;	
  
	
  	
  }	
  
}	
  
POST	 の場合のバックエンド変更
Redundant	 
	 DB	 servers
DB	 サーバを冗長化
Redundant	 DB	 servers
Master	 /	 Slave	 形式に
Redundant	 DB	 servers
WordPress	 plugin	 Hyper	 DB	 -	 

	 https://wordpress.org/plugins/hyperdb/
<?php	
  
//	
  Master	
  (	
  write	
  only	
  )	
  
$wpdb-­‐>add_database(array(	
  
	
  	
  	
  	
  	
  	
  	
  	
  'host'	
  	
  	
  	
  	
  =>	
  '192.168.0.1',	
  
	
  	
  	
  	
  	
  	
  	
  	
  'user'	
  	
  	
  	
  	
  =>	
  DB_USER,	
  
	
  	
  	
  	
  	
  	
  	
  	
  'password'	
  =>	
  DB_PASSWORD,	
  
	
  	
  	
  	
  	
  	
  	
  	
  'name'	
  	
  	
  	
  	
  =>	
  DB_NAME,	
  
	
  	
  	
  	
  	
  	
  	
  	
  'write'	
  	
  	
  	
  =>	
  1,	
  
	
  	
  	
  	
  	
  	
  	
  	
  'read'	
  	
  	
  	
  	
  =>	
  0,	
  
));	
  
	
  	
  
//	
  Slave	
  (	
  read	
  only	
  )	
  
$wpdb-­‐>add_database(array(	
  
HyperDB	 -	 db-config.php
Redundant	 DB	 servers
//	
  Slave	
  (	
  read	
  only	
  )	
  
$wpdb-­‐>add_database(array(	
  
	
  	
  	
  	
  	
  	
  	
  	
  'host'	
  	
  	
  	
  	
  =>	
  '192.168.0.2',	
  
	
  	
  	
  	
  	
  	
  	
  	
  'user'	
  	
  	
  	
  	
  =>	
  DB_USER,	
  
	
  	
  	
  	
  	
  	
  	
  	
  'password'	
  =>	
  DB_PASSWORD,	
  
	
  	
  	
  	
  	
  	
  	
  	
  'name'	
  	
  	
  	
  	
  =>	
  DB_NAME,	
  
	
  	
  	
  	
  	
  	
  	
  	
  'write'	
  	
  	
  	
  =>	
  0,	
  
	
  	
  	
  	
  	
  	
  	
  	
  'read'	
  	
  	
  	
  	
  =>	
  1,	
  
));
HyperDB	 -	 db-config.php
Redundant	 DB	 servers
Thanks	 !

Más contenido relacionado

La actualidad más candente

Apache Traffic Server & Lua
Apache Traffic Server & LuaApache Traffic Server & Lua
Apache Traffic Server & LuaKit Chan
 
Load Balancing MySQL with HAProxy - Slides
Load Balancing MySQL with HAProxy - SlidesLoad Balancing MySQL with HAProxy - Slides
Load Balancing MySQL with HAProxy - SlidesSeveralnines
 
Nginx: Accelerate Rails, HTTP Tricks
Nginx: Accelerate Rails, HTTP TricksNginx: Accelerate Rails, HTTP Tricks
Nginx: Accelerate Rails, HTTP TricksAdam Wiggins
 
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...Ontico
 
Clug 2012 March web server optimisation
Clug 2012 March   web server optimisationClug 2012 March   web server optimisation
Clug 2012 March web server optimisationgrooverdan
 
Intro ProxySQL
Intro ProxySQLIntro ProxySQL
Intro ProxySQLI Goo Lee
 
Varnish Configuration Step by Step
Varnish Configuration Step by StepVarnish Configuration Step by Step
Varnish Configuration Step by StepKim Stefan Lindholm
 
Reverse proxy & web cache with NGINX, HAProxy and Varnish
Reverse proxy & web cache with NGINX, HAProxy and VarnishReverse proxy & web cache with NGINX, HAProxy and Varnish
Reverse proxy & web cache with NGINX, HAProxy and VarnishEl Mahdi Benzekri
 
PGEncryption_Tutorial
PGEncryption_TutorialPGEncryption_Tutorial
PGEncryption_TutorialVibhor Kumar
 
Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariJoseph Scott
 
MySQL High Availability Deep Dive
MySQL High Availability Deep DiveMySQL High Availability Deep Dive
MySQL High Availability Deep Divehastexo
 
Introduction to performance tuning perl web applications
Introduction to performance tuning perl web applicationsIntroduction to performance tuning perl web applications
Introduction to performance tuning perl web applicationsPerrin Harkins
 
Troubleshooting redis
Troubleshooting redisTroubleshooting redis
Troubleshooting redisDaeMyung Kang
 

La actualidad más candente (19)

My Old Friend Malloc
My Old Friend MallocMy Old Friend Malloc
My Old Friend Malloc
 
Apache Traffic Server & Lua
Apache Traffic Server & LuaApache Traffic Server & Lua
Apache Traffic Server & Lua
 
Oscon 2010 - ATS
Oscon 2010 - ATSOscon 2010 - ATS
Oscon 2010 - ATS
 
OTRS
OTRSOTRS
OTRS
 
Secure PostgreSQL deployment
Secure PostgreSQL deploymentSecure PostgreSQL deployment
Secure PostgreSQL deployment
 
Load Balancing MySQL with HAProxy - Slides
Load Balancing MySQL with HAProxy - SlidesLoad Balancing MySQL with HAProxy - Slides
Load Balancing MySQL with HAProxy - Slides
 
Nginx: Accelerate Rails, HTTP Tricks
Nginx: Accelerate Rails, HTTP TricksNginx: Accelerate Rails, HTTP Tricks
Nginx: Accelerate Rails, HTTP Tricks
 
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
Как Web-акселератор акселерирует ваш сайт / Александр Крижановский (Tempesta ...
 
Shootout at the AWS Corral
Shootout at the AWS CorralShootout at the AWS Corral
Shootout at the AWS Corral
 
Clug 2012 March web server optimisation
Clug 2012 March   web server optimisationClug 2012 March   web server optimisation
Clug 2012 March web server optimisation
 
Intro ProxySQL
Intro ProxySQLIntro ProxySQL
Intro ProxySQL
 
Varnish Configuration Step by Step
Varnish Configuration Step by StepVarnish Configuration Step by Step
Varnish Configuration Step by Step
 
Reverse proxy & web cache with NGINX, HAProxy and Varnish
Reverse proxy & web cache with NGINX, HAProxy and VarnishReverse proxy & web cache with NGINX, HAProxy and Varnish
Reverse proxy & web cache with NGINX, HAProxy and Varnish
 
04 web optimization
04 web optimization04 web optimization
04 web optimization
 
PGEncryption_Tutorial
PGEncryption_TutorialPGEncryption_Tutorial
PGEncryption_Tutorial
 
Site Performance - From Pinto to Ferrari
Site Performance - From Pinto to FerrariSite Performance - From Pinto to Ferrari
Site Performance - From Pinto to Ferrari
 
MySQL High Availability Deep Dive
MySQL High Availability Deep DiveMySQL High Availability Deep Dive
MySQL High Availability Deep Dive
 
Introduction to performance tuning perl web applications
Introduction to performance tuning perl web applicationsIntroduction to performance tuning perl web applications
Introduction to performance tuning perl web applications
 
Troubleshooting redis
Troubleshooting redisTroubleshooting redis
Troubleshooting redis
 

Destacado

Word Camp Kansai 2014 - MVC Framework
Word Camp Kansai 2014 - MVC FrameworkWord Camp Kansai 2014 - MVC Framework
Word Camp Kansai 2014 - MVC Frameworkcodebyjeff
 
2014年6月7日【ハンズオン】体験して学ぶ はじめてのブログ・サイト制作
2014年6月7日【ハンズオン】体験して学ぶ はじめてのブログ・サイト制作2014年6月7日【ハンズオン】体験して学ぶ はじめてのブログ・サイト制作
2014年6月7日【ハンズオン】体験して学ぶ はじめてのブログ・サイト制作Takashi Hosoya
 
My '_s' Contributor’s Story
My '_s' Contributor’s StoryMy '_s' Contributor’s Story
My '_s' Contributor’s StoryKazue Igarashi
 
WCK2014[ハンズオン] 体験して学ぶ はじめてのブログ・サイト制作 〜WordPress.comでサイトを作ってみよう〜
WCK2014[ハンズオン] 体験して学ぶ はじめてのブログ・サイト制作 〜WordPress.comでサイトを作ってみよう〜WCK2014[ハンズオン] 体験して学ぶ はじめてのブログ・サイト制作 〜WordPress.comでサイトを作ってみよう〜
WCK2014[ハンズオン] 体験して学ぶ はじめてのブログ・サイト制作 〜WordPress.comでサイトを作ってみよう〜tokumotonahoko
 
WordCamp Kansai 2014 セキュリティ&バックアップ
WordCamp Kansai 2014 セキュリティ&バックアップWordCamp Kansai 2014 セキュリティ&バックアップ
WordCamp Kansai 2014 セキュリティ&バックアップTomoyuki Sugita
 
今、WordPress を使う理由
今、WordPress を使う理由今、WordPress を使う理由
今、WordPress を使う理由Naoko Takano
 
WordPressのプラグイン、テーマ開発のビジネスモデル研究
WordPressのプラグイン、テーマ開発のビジネスモデル研究WordPressのプラグイン、テーマ開発のビジネスモデル研究
WordPressのプラグイン、テーマ開発のビジネスモデル研究wpgogo
 
Layout analyzerでのgroovyの利用について
Layout analyzerでのgroovyの利用についてLayout analyzerでのgroovyの利用について
Layout analyzerでのgroovyの利用についてkimukou_26 Kimukou
 
主婦でもできる Android Layout
主婦でもできる Android Layout主婦でもできる Android Layout
主婦でもできる Android LayoutHiromi Tsuzuki
 
20120407 ASP.NET+C#で開発する大規模ソーシャルゲーム
20120407 ASP.NET+C#で開発する大規模ソーシャルゲーム20120407 ASP.NET+C#で開発する大規模ソーシャルゲーム
20120407 ASP.NET+C#で開発する大規模ソーシャルゲームhideyuki ikeda
 
Ruby使いのためのScalaのススメ
Ruby使いのためのScalaのススメRuby使いのためのScalaのススメ
Ruby使いのためのScalaのススメOuka Yuka
 
ngServer and-collaboratived-development-between-san-francisco-and-tokyo
ngServer and-collaboratived-development-between-san-francisco-and-tokyongServer and-collaboratived-development-between-san-francisco-and-tokyo
ngServer and-collaboratived-development-between-san-francisco-and-tokyoSatoshi Tanaka
 
Building scalablewebapps
Building scalablewebappsBuilding scalablewebapps
Building scalablewebappsAyumu Aizawa
 
ソフトウェアパッケージベンダーのためのクラウドソリューション「SQL Anywhere OnDemand Edition」
ソフトウェアパッケージベンダーのためのクラウドソリューション「SQL Anywhere OnDemand Edition」ソフトウェアパッケージベンダーのためのクラウドソリューション「SQL Anywhere OnDemand Edition」
ソフトウェアパッケージベンダーのためのクラウドソリューション「SQL Anywhere OnDemand Edition」nisobe58
 
「再代入なんて、あるわけない」 ~ふつうのプログラマが関数型言語を知るべき理由~ (Gunma.web #5 2011/05/14)
「再代入なんて、あるわけない」 ~ふつうのプログラマが関数型言語を知るべき理由~ (Gunma.web #5 2011/05/14)「再代入なんて、あるわけない」 ~ふつうのプログラマが関数型言語を知るべき理由~ (Gunma.web #5 2011/05/14)
「再代入なんて、あるわけない」 ~ふつうのプログラマが関数型言語を知るべき理由~ (Gunma.web #5 2011/05/14)parrotstudio
 
【WordCamp Kansai 2014】WordPressで実制作までまるっとHAPPY!フリーランスママの愛されディレクション
【WordCamp Kansai 2014】WordPressで実制作までまるっとHAPPY!フリーランスママの愛されディレクション【WordCamp Kansai 2014】WordPressで実制作までまるっとHAPPY!フリーランスママの愛されディレクション
【WordCamp Kansai 2014】WordPressで実制作までまるっとHAPPY!フリーランスママの愛されディレクションAimi Sata
 
17 E-5 震災とHackとクラウドと 亀渕分
17 E-5 震災とHackとクラウドと 亀渕分17 E-5 震災とHackとクラウドと 亀渕分
17 E-5 震災とHackとクラウドと 亀渕分Keiji Kamebuchi
 
アイデアを塩漬けにしない-世界中の人に手伝ってもらう方法-
アイデアを塩漬けにしない-世界中の人に手伝ってもらう方法-アイデアを塩漬けにしない-世界中の人に手伝ってもらう方法-
アイデアを塩漬けにしない-世界中の人に手伝ってもらう方法-nishio
 
Japan Developer Summit (jp) - Cloud Foundry, the Open Platform As A Service
Japan Developer Summit (jp) - Cloud Foundry, the Open Platform As A ServiceJapan Developer Summit (jp) - Cloud Foundry, the Open Platform As A Service
Japan Developer Summit (jp) - Cloud Foundry, the Open Platform As A ServicePatrick Chanezon
 

Destacado (20)

Word Camp Kansai 2014 - MVC Framework
Word Camp Kansai 2014 - MVC FrameworkWord Camp Kansai 2014 - MVC Framework
Word Camp Kansai 2014 - MVC Framework
 
2014年6月7日【ハンズオン】体験して学ぶ はじめてのブログ・サイト制作
2014年6月7日【ハンズオン】体験して学ぶ はじめてのブログ・サイト制作2014年6月7日【ハンズオン】体験して学ぶ はじめてのブログ・サイト制作
2014年6月7日【ハンズオン】体験して学ぶ はじめてのブログ・サイト制作
 
My '_s' Contributor’s Story
My '_s' Contributor’s StoryMy '_s' Contributor’s Story
My '_s' Contributor’s Story
 
WCK2014[ハンズオン] 体験して学ぶ はじめてのブログ・サイト制作 〜WordPress.comでサイトを作ってみよう〜
WCK2014[ハンズオン] 体験して学ぶ はじめてのブログ・サイト制作 〜WordPress.comでサイトを作ってみよう〜WCK2014[ハンズオン] 体験して学ぶ はじめてのブログ・サイト制作 〜WordPress.comでサイトを作ってみよう〜
WCK2014[ハンズオン] 体験して学ぶ はじめてのブログ・サイト制作 〜WordPress.comでサイトを作ってみよう〜
 
WordCamp Kansai 2014 セキュリティ&バックアップ
WordCamp Kansai 2014 セキュリティ&バックアップWordCamp Kansai 2014 セキュリティ&バックアップ
WordCamp Kansai 2014 セキュリティ&バックアップ
 
今、WordPress を使う理由
今、WordPress を使う理由今、WordPress を使う理由
今、WordPress を使う理由
 
WordPressのプラグイン、テーマ開発のビジネスモデル研究
WordPressのプラグイン、テーマ開発のビジネスモデル研究WordPressのプラグイン、テーマ開発のビジネスモデル研究
WordPressのプラグイン、テーマ開発のビジネスモデル研究
 
Layout analyzerでのgroovyの利用について
Layout analyzerでのgroovyの利用についてLayout analyzerでのgroovyの利用について
Layout analyzerでのgroovyの利用について
 
主婦でもできる Android Layout
主婦でもできる Android Layout主婦でもできる Android Layout
主婦でもできる Android Layout
 
参考テキスト
参考テキスト参考テキスト
参考テキスト
 
20120407 ASP.NET+C#で開発する大規模ソーシャルゲーム
20120407 ASP.NET+C#で開発する大規模ソーシャルゲーム20120407 ASP.NET+C#で開発する大規模ソーシャルゲーム
20120407 ASP.NET+C#で開発する大規模ソーシャルゲーム
 
Ruby使いのためのScalaのススメ
Ruby使いのためのScalaのススメRuby使いのためのScalaのススメ
Ruby使いのためのScalaのススメ
 
ngServer and-collaboratived-development-between-san-francisco-and-tokyo
ngServer and-collaboratived-development-between-san-francisco-and-tokyongServer and-collaboratived-development-between-san-francisco-and-tokyo
ngServer and-collaboratived-development-between-san-francisco-and-tokyo
 
Building scalablewebapps
Building scalablewebappsBuilding scalablewebapps
Building scalablewebapps
 
ソフトウェアパッケージベンダーのためのクラウドソリューション「SQL Anywhere OnDemand Edition」
ソフトウェアパッケージベンダーのためのクラウドソリューション「SQL Anywhere OnDemand Edition」ソフトウェアパッケージベンダーのためのクラウドソリューション「SQL Anywhere OnDemand Edition」
ソフトウェアパッケージベンダーのためのクラウドソリューション「SQL Anywhere OnDemand Edition」
 
「再代入なんて、あるわけない」 ~ふつうのプログラマが関数型言語を知るべき理由~ (Gunma.web #5 2011/05/14)
「再代入なんて、あるわけない」 ~ふつうのプログラマが関数型言語を知るべき理由~ (Gunma.web #5 2011/05/14)「再代入なんて、あるわけない」 ~ふつうのプログラマが関数型言語を知るべき理由~ (Gunma.web #5 2011/05/14)
「再代入なんて、あるわけない」 ~ふつうのプログラマが関数型言語を知るべき理由~ (Gunma.web #5 2011/05/14)
 
【WordCamp Kansai 2014】WordPressで実制作までまるっとHAPPY!フリーランスママの愛されディレクション
【WordCamp Kansai 2014】WordPressで実制作までまるっとHAPPY!フリーランスママの愛されディレクション【WordCamp Kansai 2014】WordPressで実制作までまるっとHAPPY!フリーランスママの愛されディレクション
【WordCamp Kansai 2014】WordPressで実制作までまるっとHAPPY!フリーランスママの愛されディレクション
 
17 E-5 震災とHackとクラウドと 亀渕分
17 E-5 震災とHackとクラウドと 亀渕分17 E-5 震災とHackとクラウドと 亀渕分
17 E-5 震災とHackとクラウドと 亀渕分
 
アイデアを塩漬けにしない-世界中の人に手伝ってもらう方法-
アイデアを塩漬けにしない-世界中の人に手伝ってもらう方法-アイデアを塩漬けにしない-世界中の人に手伝ってもらう方法-
アイデアを塩漬けにしない-世界中の人に手伝ってもらう方法-
 
Japan Developer Summit (jp) - Cloud Foundry, the Open Platform As A Service
Japan Developer Summit (jp) - Cloud Foundry, the Open Platform As A ServiceJapan Developer Summit (jp) - Cloud Foundry, the Open Platform As A Service
Japan Developer Summit (jp) - Cloud Foundry, the Open Platform As A Service
 

Similar a Wckansai 2014

Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalabilityWim Godden
 
High Availability Content Caching with NGINX
High Availability Content Caching with NGINXHigh Availability Content Caching with NGINX
High Availability Content Caching with NGINXKevin Jones
 
Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012Wim Godden
 
Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)Justin Foell
 
Zendcon scaling magento
Zendcon scaling magentoZendcon scaling magento
Zendcon scaling magentoMathew Beane
 
High Availability Content Caching with NGINX
High Availability Content Caching with NGINXHigh Availability Content Caching with NGINX
High Availability Content Caching with NGINXNGINX, Inc.
 
10 Million hits a day with WordPress using a $15 VPS
10 Million hits a day  with WordPress using a $15 VPS10 Million hits a day  with WordPress using a $15 VPS
10 Million hits a day with WordPress using a $15 VPSPaolo Tonin
 
Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!WordCamp Cape Town
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newYiwei Ma
 
Less and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developersLess and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developersSeravo
 
High Performance Wordpress
High Performance WordpressHigh Performance Wordpress
High Performance WordpressGareth Davies
 
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web server
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web serverNginx 0.8.x + php 5.2.13 (fast cgi) setup web server
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web serverwruben
 
WordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineWordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineNGINX, Inc.
 
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...Nagios
 
php & performance
 php & performance php & performance
php & performancesimon8410
 
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…Atwix
 
My sql monitoring cu沙龙
My sql monitoring cu沙龙My sql monitoring cu沙龙
My sql monitoring cu沙龙colderboy17
 
Speeding Up The Snail
Speeding Up The SnailSpeeding Up The Snail
Speeding Up The SnailMarcus Deglos
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with NginxBud Siddhisena
 

Similar a Wckansai 2014 (20)

Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
High Availability Content Caching with NGINX
High Availability Content Caching with NGINXHigh Availability Content Caching with NGINX
High Availability Content Caching with NGINX
 
Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012Caching and tuning fun for high scalability @ FOSDEM 2012
Caching and tuning fun for high scalability @ FOSDEM 2012
 
Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)Nginx [engine x] and you (and WordPress)
Nginx [engine x] and you (and WordPress)
 
Zendcon scaling magento
Zendcon scaling magentoZendcon scaling magento
Zendcon scaling magento
 
High Availability Content Caching with NGINX
High Availability Content Caching with NGINXHigh Availability Content Caching with NGINX
High Availability Content Caching with NGINX
 
10 Million hits a day with WordPress using a $15 VPS
10 Million hits a day  with WordPress using a $15 VPS10 Million hits a day  with WordPress using a $15 VPS
10 Million hits a day with WordPress using a $15 VPS
 
Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!Anthony Somerset - Site Speed = Success!
Anthony Somerset - Site Speed = Success!
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 new
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 
Less and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developersLess and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developers
 
High Performance Wordpress
High Performance WordpressHigh Performance Wordpress
High Performance Wordpress
 
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web server
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web serverNginx 0.8.x + php 5.2.13 (fast cgi) setup web server
Nginx 0.8.x + php 5.2.13 (fast cgi) setup web server
 
WordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngineWordPress + NGINX Best Practices with EasyEngine
WordPress + NGINX Best Practices with EasyEngine
 
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
Nagios Conference 2014 - Rob Hassing - How To Maintain Over 20 Monitoring App...
 
php & performance
 php & performance php & performance
php & performance
 
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
Host and Boast: Best Practices for Magento Hosting | Imagine 2013 Technolog…
 
My sql monitoring cu沙龙
My sql monitoring cu沙龙My sql monitoring cu沙龙
My sql monitoring cu沙龙
 
Speeding Up The Snail
Speeding Up The SnailSpeeding Up The Snail
Speeding Up The Snail
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with Nginx
 

Más de Wataru OKAMOTO

Más de Wataru OKAMOTO (11)

re:Invent 2015 参加報告
re:Invent 2015 参加報告re:Invent 2015 参加報告
re:Invent 2015 参加報告
 
Amimoto auto scaling
Amimoto auto scalingAmimoto auto scaling
Amimoto auto scaling
 
wp cli
wp cliwp cli
wp cli
 
Word press on conoha このべん #3
Word press on conoha このべん #3Word press on conoha このべん #3
Word press on conoha このべん #3
 
Sacss sp5
Sacss sp5Sacss sp5
Sacss sp5
 
StaticPress
StaticPressStaticPress
StaticPress
 
WordPress Cloud Design Pattern
WordPress  Cloud Design PatternWordPress  Cloud Design Pattern
WordPress Cloud Design Pattern
 
High performance web server
High performance web serverHigh performance web server
High performance web server
 
Nginx + PHP
Nginx + PHPNginx + PHP
Nginx + PHP
 
Mastering WordPress Vol.1
Mastering WordPress Vol.1Mastering WordPress Vol.1
Mastering WordPress Vol.1
 
WordPress を使いこなそう
WordPress を使いこなそうWordPress を使いこなそう
WordPress を使いこなそう
 

Último

Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.IPLOOK Networks
 
Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)Muhammad Tiham Siddiqui
 
Technical SEO for Improved Accessibility WTS FEST
Technical SEO for Improved Accessibility  WTS FESTTechnical SEO for Improved Accessibility  WTS FEST
Technical SEO for Improved Accessibility WTS FESTBillieHyde
 
UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3DianaGray10
 
20140402 - Smart house demo kit
20140402 - Smart house demo kit20140402 - Smart house demo kit
20140402 - Smart house demo kitJamie (Taka) Wang
 
EMEA What is ThousandEyes? Webinar
EMEA What is ThousandEyes? WebinarEMEA What is ThousandEyes? Webinar
EMEA What is ThousandEyes? WebinarThousandEyes
 
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechWebinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechProduct School
 
Planetek Italia Srl - Corporate Profile Brochure
Planetek Italia Srl - Corporate Profile BrochurePlanetek Italia Srl - Corporate Profile Brochure
Planetek Italia Srl - Corporate Profile BrochurePlanetek Italia Srl
 
Patch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updatePatch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updateadam112203
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)codyslingerland1
 
UiPath Studio Web workshop series - Day 1
UiPath Studio Web workshop series  - Day 1UiPath Studio Web workshop series  - Day 1
UiPath Studio Web workshop series - Day 1DianaGray10
 
Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...DianaGray10
 
AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024Brian Pichman
 
UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4DianaGray10
 
Keep Your Finger on the Pulse of Your Building's Performance with IES Live
Keep Your Finger on the Pulse of Your Building's Performance with IES LiveKeep Your Finger on the Pulse of Your Building's Performance with IES Live
Keep Your Finger on the Pulse of Your Building's Performance with IES LiveIES VE
 
Flow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First FrameFlow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First FrameKapil Thakar
 
CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024Brian Pichman
 
.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptxHansamali Gamage
 
Introduction to RAG (Retrieval Augmented Generation) and its application
Introduction to RAG (Retrieval Augmented Generation) and its applicationIntroduction to RAG (Retrieval Augmented Generation) and its application
Introduction to RAG (Retrieval Augmented Generation) and its applicationKnoldus Inc.
 
TrustArc Webinar - How to Live in a Post Third-Party Cookie World
TrustArc Webinar - How to Live in a Post Third-Party Cookie WorldTrustArc Webinar - How to Live in a Post Third-Party Cookie World
TrustArc Webinar - How to Live in a Post Third-Party Cookie WorldTrustArc
 

Último (20)

Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.
 
Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)Trailblazer Community - Flows Workshop (Session 2)
Trailblazer Community - Flows Workshop (Session 2)
 
Technical SEO for Improved Accessibility WTS FEST
Technical SEO for Improved Accessibility  WTS FESTTechnical SEO for Improved Accessibility  WTS FEST
Technical SEO for Improved Accessibility WTS FEST
 
UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3
 
20140402 - Smart house demo kit
20140402 - Smart house demo kit20140402 - Smart house demo kit
20140402 - Smart house demo kit
 
EMEA What is ThousandEyes? Webinar
EMEA What is ThousandEyes? WebinarEMEA What is ThousandEyes? Webinar
EMEA What is ThousandEyes? Webinar
 
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechWebinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
 
Planetek Italia Srl - Corporate Profile Brochure
Planetek Italia Srl - Corporate Profile BrochurePlanetek Italia Srl - Corporate Profile Brochure
Planetek Italia Srl - Corporate Profile Brochure
 
Patch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 updatePatch notes explaining DISARM Version 1.4 update
Patch notes explaining DISARM Version 1.4 update
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)
 
UiPath Studio Web workshop series - Day 1
UiPath Studio Web workshop series  - Day 1UiPath Studio Web workshop series  - Day 1
UiPath Studio Web workshop series - Day 1
 
Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...
 
AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024AI Workshops at Computers In Libraries 2024
AI Workshops at Computers In Libraries 2024
 
UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4UiPath Studio Web workshop series - Day 4
UiPath Studio Web workshop series - Day 4
 
Keep Your Finger on the Pulse of Your Building's Performance with IES Live
Keep Your Finger on the Pulse of Your Building's Performance with IES LiveKeep Your Finger on the Pulse of Your Building's Performance with IES Live
Keep Your Finger on the Pulse of Your Building's Performance with IES Live
 
Flow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First FrameFlow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First Frame
 
CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024
 
.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx
 
Introduction to RAG (Retrieval Augmented Generation) and its application
Introduction to RAG (Retrieval Augmented Generation) and its applicationIntroduction to RAG (Retrieval Augmented Generation) and its application
Introduction to RAG (Retrieval Augmented Generation) and its application
 
TrustArc Webinar - How to Live in a Post Third-Party Cookie World
TrustArc Webinar - How to Live in a Post Third-Party Cookie WorldTrustArc Webinar - How to Live in a Post Third-Party Cookie World
TrustArc Webinar - How to Live in a Post Third-Party Cookie World
 

Wckansai 2014

  • 1. Nginx, MySQL Replication… WordPress サーバの運用 (構築編) WordCamp Kansai 2014
  • 5. * WordPress 運用時の最小構成 * Web サーバを Apache から Nginx に
 * CDN の導入 * Web サーバを冗長化 * DB サーバを冗長化 Menu for Today
  • 7. Minimum Configuration *Apache ( mod_rewrite ) ! *php 5.2.4 or higher ! *MySQL 5.0 or higher
  • 8. <ifModule  mod_expires.c>   ExpiresActive  On   ExpiresDefault  "access  plus  1  seconds"   ExpiresByType  text/html  "access  plus  1  seconds"   ExpiresByType  image/gif  "access  plus  30  days"   ExpiresByType  image/jpeg  "access  plus  30  days"   ExpiresByType  image/png  "access  plus  30  days"   ExpiresByType  text/css  "access  plus  30  days"   ExpiresByType  text/javascript  "access  plus  30  days"   ExpiresByType  application/x-­‐javascript  "access  plus  30  days"   ExpiresByType  application/x-­‐shockwave-­‐flash  "access  plus  30  days"   </ifModule> 有効期限の設定 Minimum Configuration
  • 9. <link  rel="stylesheet"  type="text/css"  media=“all"    href="<?php  echo  get_stylesheet_uri();  ?>   ?ver=<?php  echo  filemtime(get_stylesheet_directory()  .  '/style.css');  ?>"  /> キャッシュのコントロール add_filter('stylesheet_uri',  function($stylesheet_uri){      $stylesheet  =  get_stylesheet_directory()  .  '/style.css';      $stylesheet_uri  .=  '?ver='  .  filemtime($stylesheet);      return  $stylesheet_uri;   }); または Minimum Configuration
  • 10. <IfModule  mod_deflate.c>   SetOutputFilter  DEFLATE   BrowserMatch  ^Mozilla/4  gzip-­‐only-­‐text/html   BrowserMatch  ^Mozilla/4.0[678]  no-­‐gzip   BrowserMatch  bMSI[E]  !no-­‐gzip  !gzip-­‐only-­‐text/html   SetEnvIfNoCase  Request_URI  .(?:gif|jpe?g|png|ico)$  no-­‐gzip  dont-­‐vary   SetEnvIfNoCase  Request_URI  _.utxt$  no-­‐gzip   #DeflateCompressionLevel  4   AddOutputFilterByType  DEFLATE  text/plain   AddOutputFilterByType  DEFLATE  text/html   AddOutputFilterByType  DEFLATE  text/xml   AddOutputFilterByType  DEFLATE  text/css   AddOutputFilterByType  DEFLATE  application/xml   AddOutputFilterByType  DEFLATE  application/x-­‐javascript   AddOutputFilterByType  DEFLATE  application/x-­‐httpd-­‐php   </IfModule> 圧縮転送の設定 Minimum Configuration
  • 11. #  BEGIN  WordPress   <IfModule  mod_rewrite.c>   RewriteEngine  On   RewriteBase  /   RewriteCond  %{REQUEST_FILENAME}  !-­‐f   RewriteCond  %{REQUEST_FILENAME}  !-­‐d   RewriteRule  .  /index.php  [L]   </IfModule>       #  END  WordPress   カスタムパーマリンクの設定 Minimum Configuration
  • 12. #  BEGIN  WordPress   <IfModule  mod_rewrite.c>   RewriteEngine  On   RewriteBase  /   RewriteCond  %{REQUEST_FILENAME}  !.(js|css|jpe?g|png|gif|ico)$   RewriteCond  %{REQUEST_FILENAME}  !-­‐f   RewriteCond  %{REQUEST_FILENAME}  !-­‐d   RewriteRule  .  /index.php  [L]   </IfModule>       #  END  WordPress   Minimum Configuration カスタムパーマリンクの設定
  • 14. /usr/share/mysql    my-­‐innodb-­‐heavy-­‐4G.cnf    InnoDB  memory  4G    my-­‐huge.cnf                          memory  1G  -­‐  2G    my-­‐large.cnf                        memory  -­‐  512MB    my-­‐medium.cnf                      memory  -­‐  128MB    my-­‐small.cnf                        memory  -­‐  64MB   MySQL のチューニング Minimum Configuration
  • 15. $  wget  -­‐O  -­‐  mysqltuner.pl  |  perl   
  >>    MySQLTuner  1.3.0  -­‐  Major  Hayden  <major  >>    Bug  reports,  feature  requests,  and  dow  >>    Run  with  '-­‐-­‐help'  for  additional  optio [!!]  Successfully  authenticated  with  no  pas [OK]  Currently  running  supported  MySQL  vers [OK]  Operating  on  64-­‐bit  architecture   ! -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  Storage  Engine  Statistics   Minimum Configuration MySQL のチューニング
  • 16. -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  Storage  Engine  Statistics  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐ [-­‐-­‐]  Status:  +ARCHIVE  +BLACKHOLE  +CSV  -­‐FEDERATED  +I [-­‐-­‐]  Data  in  InnoDB  tables:  496K  (Tables:  12)   [-­‐-­‐]  Data  in  PERFORMANCE_SCHEMA  tables:  0B  (Tables: [OK]  Total  fragmented  tables:  0 Minimum Configuration MySQL のチューニング
  • 17. -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  Security  Recommendations    -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐ [!!]  User  '@localhost'  has  no  password  set.   [!!]  User  '@v210-­‐172-­‐187-­‐188.z0d1.static.cnode.jp'   [!!]  User  'root@127.0.0.1'  has  no  password  set.   [!!]  User  'root@::1'  has  no  password  set.   [!!]  User  'root@localhost'  has  no  password  set.   [!!]  User  'root@v210-­‐172-­‐187-­‐188.z0d1.static.cnode. Minimum Configuration MySQL のチューニング
  • 18. -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  Performance  Metrics  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐ [-­‐-­‐]  Up  for:  5h  5m  4s  (111  q  [0.006  qps],  8  conn,  T [-­‐-­‐]  Reads  /  Writes:  96%  /  4%   [-­‐-­‐]  Total  buffers:  232.0M  global  +  1.5M  per  thread [OK]  Maximum  possible  memory  usage:  424.0M  (2%  of  i [OK]  Slow  queries:  0%  (0/111)   [OK]  Highest  usage  of  available  connections:  0%  (1/ [OK]  Key  buffer  size  /  total  MyISAM  indexes:  16.0M/ [OK]  Query  cache  efficiency:  41.3%  (38  cached  /  92   [OK]  Query  cache  prunes  per  day:  0   [OK]  Sorts  requiring  temporary  tables:  0%  (0  temp  s Minimum Configuration MySQL のチューニング
  • 19. -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐  Recommendations  -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐ General  recommendations:          MySQL  started  within  last  24  hours  -­‐  recommenda        Enable  the  slow  query  log  to  troubleshoot  bad  q        When  making  adjustments,  make  tmp_table_size/ma        Reduce  your  SELECT  DISTINCT  queries  without  LIM Variables  to  adjust:          tmp_table_size  (>  64M)          max_heap_table_size  (>  64M)   ! Minimum Configuration MySQL のチューニング
  • 20. Nginx Web サーバを Apache から Nginx に
  • 21. Nginx ? * OSS の軽量 HTTP サーバ ! ! * スレッドモデルでは無く、イベントループモデルを採用 ! ! * トラフィック量上位100万サイトでのシェア20%
  • 22. Nginx ? * OSS の軽量 HTTP サーバ ! ! * スレッドモデルでは無く、イベントループモデルを採用 ! ! * トラフィック量上位100万サイトでのシェア20%
  • 23. Nginx ? * OSS の軽量 HTTP サーバ ! ! * スレッドモデルでは無く、イベントループモデルを採用 ! ! * トラフィック量上位100万サイトでのシェア20%
  • 25. WordPres.com でも採用 $  wget  -­‐S  -­‐-­‐spider  http://wordpress.com   wordpress.com|66.155.11.243|:80  に接続しています...  接続しました。   HTTP  による接続要求を送信しました、応答を待っています...        HTTP/1.1  200  OK      Server:  nginx      Date:  Tue,  15  Apr  2014  05:58:07  GMT      Content-­‐Type:  text/html;  charset=utf-­‐8      Connection:  keep-­‐alive      Vary:  Accept-­‐Encoding      X-­‐Frame-­‐Options:  SAMEORIGIN      Vary:  Cookie      Set-­‐Cookie:  wordpress_homepage=existing;  expires=Wed,  30-­‐Apr-­‐2014   05:58:07  GMT   Nginx ?
  • 26. PHP は fast-CGI で Apache の mod_php のように Web サーバと同一プロセ スで php を動作させることはできません。! ! php-fpm などを使って別プロセスで動作させる必要があり ます。! Nginx ?
  • 28. nginx.conf の例 server  {      listen            80  default;      server_name  _;      root                /path/to/app;      index              index.php  index.html  index.htm;      charset          utf-­‐8;   !    location  ~  .php$  {          fastcgi_pass      unix:/var/run/php-­‐fpm.sock;          fastcgi_index    index.php;          fastcgi_param  SCRIPT_FILENAME   Nginx + php-fpm
  • 29. php-fpm.conf の例 [www]   listen  =  /var/run/php-­‐fpm.sock   listen.owner  =  nginx   listen.group  =  nginx   listen.mode  =  0666   ! user  =  nginx   group  =  nginx   ! pm  =  dynamic   pm.max_children  =  15   pm.start_servers  =  5   Nginx + php-fpm
  • 30. Nginx Performance Nginx Reverse Proxy Cache の紹介
  • 32. ab -n 100 -c 10 (WordPress トップページ)! ! * Requests per second: 4.26 [#/sec]! ! * Time per request: 2346.174 [ms]! ! * Connection Times Total: 2309 [ms] Nginx Performance Apache, mod_php, WordPress
  • 34. ab -n 100 -c 10 (WordPress トップページ)! ! * Requests per second: 5.79 [#/sec]! ! * Time per request: 1726.535 [ms]! ! * Connection Times Total: 1617 [ms] Nginx Performance Nginx, php-fpm, WordPress
  • 36. ab -n 100 -c 10 (WordPress トップページ)! ! * Requests per second: 141.24 [#/sec]! ! * Time per request: 708.007 [ms]! ! * Connection Times Total: 636 [ms] Nginx Performance Nginx Reverse Proxy Cache, WordPress
  • 38. nginx.conf の例 http  {              :      proxy_cache_path    /var/cache/nginx/proxy_cache  levels=1:2                                          keys_zone=czone:32m  max_size=256m  inactive=1440m;      proxy_temp_path      /var/cache/nginx/proxy_temp;      proxy_cache_key      "$scheme://$host$request_uri";      proxy_set_header    Host                              $host;      proxy_set_header    Remote-­‐Addr                $remote_addr;      proxy_set_header    X-­‐Forwarded-­‐Host      $host;      proxy_set_header    X-­‐Forwarded-­‐Server  $host;      proxy_set_header    X-­‐Forwarded-­‐For        $proxy_add_x_forwarded_for;   !    upstream  backend  {          server  unix:/var/run/nginx-­‐backend.sock;      }              :   } Reverse Proxy Cache
  • 39. http  {              :      proxy_cache_path    /var/cache/nginx/proxy_cache  levels=1:2                                          keys_zone=czone:32m  max_size=256m  inactive=1440m;      proxy_temp_path      /var/cache/nginx/proxy_temp;      proxy_cache_key      "$scheme://$host$request_uri";      proxy_set_header    Host                              $host;      proxy_set_header    Remote-­‐Addr                $remote_addr;      proxy_set_header    X-­‐Forwarded-­‐Host      $host;      proxy_set_header    X-­‐Forwarded-­‐Server  $host;      proxy_set_header    X-­‐Forwarded-­‐For        $proxy_add_x_forwarded_for;   !    upstream  backend  {          server  unix:/var/run/nginx-­‐backend.sock;      }              :   } Reverse Proxy Cache nginx.conf の例
  • 40. http  {              :      proxy_cache_path    /var/cache/nginx/proxy_cache  levels=1:2                                          keys_zone=czone:32m  max_size=256m  inactive=1440m;      proxy_temp_path      /var/cache/nginx/proxy_temp;      proxy_cache_key      "$scheme://$host$request_uri";      proxy_set_header    Host                              $host;      proxy_set_header    Remote-­‐Addr                $remote_addr;      proxy_set_header    X-­‐Forwarded-­‐Host      $host;      proxy_set_header    X-­‐Forwarded-­‐Server  $host;      proxy_set_header    X-­‐Forwarded-­‐For        $proxy_add_x_forwarded_for;   !    upstream  backend  {          server  unix:/var/run/nginx-­‐backend.sock;      }              :   } Reverse Proxy Cache nginx.conf の例
  • 41. http  {              :      proxy_cache_path    /var/cache/nginx/proxy_cache  levels=1:2                                          keys_zone=czone:32m  max_size=256m  inactive=1440m;      proxy_temp_path      /var/cache/nginx/proxy_temp;      proxy_cache_key      "$scheme://$host$request_uri";      proxy_set_header    Host                              $host;      proxy_set_header    Remote-­‐Addr                $remote_addr;      proxy_set_header    X-­‐Forwarded-­‐Host      $host;      proxy_set_header    X-­‐Forwarded-­‐Server  $host;      proxy_set_header    X-­‐Forwarded-­‐For        $proxy_add_x_forwarded_for;   !    upstream  backend  {          server  unix:/var/run/nginx-­‐backend.sock;      }              :   } Reverse Proxy Cache nginx.conf の例
  • 42. server  {      listen            80  default;      server_name  _;      root                /path/to/wordpress;      index              index.php  index.html  index.htm;   !    location  ~*  .(js|css|jpe?g|gif|png|swf|wmv|flv|ico)$  {          expires  30d;      }   !    location  /  {          set  $do_not_cache  0;          if  ($request_method  =  POST)  {              set  $do_not_cache  1;          }          proxy_no_cache          $do_not_cache;          proxy_cache_bypass  $do_not_cache;          proxy_redirect          off;          proxy_cache                czone;          proxy_cache_key        "$scheme://$host$request_uri";          proxy_cache_valid    200  0m;          proxy_pass  http://backend;      }   }
  • 43. server  {      listen            80  default;      server_name  _;      root                /path/to/wordpress;      index              index.php  index.html  index.htm;   !    location  ~*  .(js|css|jpe?g|gif|png|swf|wmv|flv|ico)$  {          expires  30d;      }   !    location  /  {          set  $do_not_cache  0;          if  ($request_method  =  POST)  {              set  $do_not_cache  1;          }          proxy_no_cache          $do_not_cache;          proxy_cache_bypass  $do_not_cache;          proxy_redirect          off;          proxy_cache                czone;          proxy_cache_key        "$scheme://$host$request_uri";          proxy_cache_valid    200  0m;          proxy_pass  http://backend;      }   }
  • 44. server  {      listen            80  default;      server_name  _;      root                /path/to/wordpress;      index              index.php  index.html  index.htm;   !    location  ~*  .(js|css|jpe?g|gif|png|swf|wmv|flv|ico)$  {          expires  30d;      }   !    location  /  {          set  $do_not_cache  0;          if  ($request_method  =  POST)  {              set  $do_not_cache  1;          }          proxy_no_cache          $do_not_cache;          proxy_cache_bypass  $do_not_cache;          proxy_redirect          off;          proxy_cache                czone;          proxy_cache_key        "$scheme://$host$request_uri";          proxy_cache_valid    200  0m;          proxy_pass  http://backend;      }   }
  • 45. server  {      listen            unix:/var/run/nginx-­‐backend.sock;      server_name  _;      root                /path/to/wordpress;      index              index.php  index.html  index.htm;      charset          utf-­‐8;   !    gzip                            off;      gzip_vary                  off;   !    location  ~  .php$  {          fastcgi_pass      unix:/var/run/php-­‐fpm.sock;          fastcgi_index    index.php;          fastcgi_param    SCRIPT_FILENAME                                              $document_root$fastcgi_script_name;          include                fastcgi_params;          fastcgi_pass_header  "X-­‐Accel-­‐Redirect";          fastcgi_pass_header  "X-­‐Accel-­‐Buffering";          fastcgi_pass_header  "X-­‐Accel-­‐Charset";          fastcgi_pass_header  "X-­‐Accel-­‐Expires";          fastcgi_pass_header  "X-­‐Accel-­‐Limit-­‐Rate";      }   }
  • 46. server  {      listen            unix:/var/run/nginx-­‐backend.sock;      server_name  _;      root                /path/to/app;      index              index.php  index.html  index.htm;      charset          utf-­‐8;   !    gzip                            off;      gzip_vary                  off;   !    location  ~  .php$  {          fastcgi_pass      unix:/var/run/php-­‐fpm.sock;          fastcgi_index    index.php;          fastcgi_param    SCRIPT_FILENAME                                              $document_root$fastcgi_script_name;          include                fastcgi_params;          fastcgi_pass_header  "X-­‐Accel-­‐Redirect";          fastcgi_pass_header  "X-­‐Accel-­‐Buffering";          fastcgi_pass_header  "X-­‐Accel-­‐Charset";          fastcgi_pass_header  "X-­‐Accel-­‐Expires";          fastcgi_pass_header  "X-­‐Accel-­‐Limit-­‐Rate";      }   }
  • 47. cache 時間を php で制御 <?php   header('X-­‐Accel-­‐Expires:  '.  60  *  60  *  24);   ?> Reverse Proxy Cache
  • 48. Reverse Proxy Cache WP plugin Nginx Cache Controller - 
 https://wordpress.org/plugins/nginx-champuru/
  • 49. Reverse Proxy Cache WP plugin Nginx Mobile Theme - 
 https://wordpress.org/plugins/nginx-mobile-theme/
  • 51. CDN CDN ( Contents Delivery Network ) ?
  • 52. CDNAkamai - http://www.akamai.co.jp/enja/
  • 53. CDN CloudFront - 
 http://aws.amazon.com/jp/cloudfront/
  • 54. CDN CloudFlare - 
 https://www.cloudflare.com/
  • 55. CDN Jetpack Photon - 
 http://jetpack.me/support/photon/
  • 57. CDNWP plugin 絡新婦 - 
 http://wordpress.org/plugins/nephila-clavata/
  • 60. Redundant Web servers Web サーバを冗長化
  • 61. Redundant Web servers NFS で WordPress を共有
  • 62. Redundant Web servers Master / Slave 形式に
  • 63. server  {      listen            80  default;      server_name  _;      root                /path/to/wordpress;      index              index.php  index.html  index.htm;   !    set  $backend  'http://127.0.0.1:8080';      if  ($request_method  =  POST)  {          set  $backend  'http://{master  server  IP}:8080';      }   !    location  /  {          proxy_pass                  $backend;      }   }   Redundant Web servers POST の場合のバックエンド変更
  • 64. Redundant Web servers server  {      listen            80  default;      server_name  _;      root                /path/to/wordpress;      index              index.php  index.html  index.htm;   !    set  $backend  'http://127.0.0.1:8080';      if  ($request_method  =  POST)  {          set  $backend  'http://{master  server  IP}:8080';      }   !    location  /  {          proxy_pass                  $backend;      }   }   POST の場合のバックエンド変更
  • 65. Redundant DB servers DB サーバを冗長化
  • 66. Redundant DB servers Master / Slave 形式に
  • 67. Redundant DB servers WordPress plugin Hyper DB - 
 https://wordpress.org/plugins/hyperdb/
  • 68. <?php   //  Master  (  write  only  )   $wpdb-­‐>add_database(array(                  'host'          =>  '192.168.0.1',                  'user'          =>  DB_USER,                  'password'  =>  DB_PASSWORD,                  'name'          =>  DB_NAME,                  'write'        =>  1,                  'read'          =>  0,   ));       //  Slave  (  read  only  )   $wpdb-­‐>add_database(array(   HyperDB - db-config.php Redundant DB servers
  • 69. //  Slave  (  read  only  )   $wpdb-­‐>add_database(array(                  'host'          =>  '192.168.0.2',                  'user'          =>  DB_USER,                  'password'  =>  DB_PASSWORD,                  'name'          =>  DB_NAME,                  'write'        =>  0,                  'read'          =>  1,   )); HyperDB - db-config.php Redundant DB servers