ab压测,挺满意了ww
本来想洗个澡结果没水了。然后我就果着写博客sad
步骤如下
- 新建DIY Gear,clone这个项目,记得填
http://cartreflect-claytondev.rhcloud.com/github/tengyifei/openshift-cartridge-nginx-hhvm
别直接填github地址,貌似
clone不了要加上.git?。加上mysql cartridges,需要的话再加个phpmyadmin - 完成后进入应用url看能不能打开。正常情况的话会显示一个停放页,openshift的控制台里应用标题底下也会显示类似Nginx HHVM 3.2.0字样,说明部署成功
- 然后装wordpress
12345cd app-root/repo/wwwwget http://cn.wordpress.org/wordpress-4.0-zh_CN.tar.gztar zxvf wordpress-4.0-zh_CN.tar.gzmv wordpress/* ./rmdir wordpress
- 配置hhvm,参考http://hhvm.com/blog/3095/getting-wordpress-running-on-hhvm,将以下内容填入~/app-root/repo/config/hhvm.d/config.hdf
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455Server {Port = 80SourceRoot = [OPENSHIFT_REPO_DIR]}Eval {Jit = true}Log {Level = ErrorUseLogFile = trueFile = /var/log/hhvm/error.logAccess {* {File = /var/log/hhvm/access.logFormat = %h %l %u %t "%r" %>s %b}}}VirtualHost {* {Pattern = .*RewriteRules {dirindex {pattern = ^/(.*)/$to = $1/index.phpqsa = true}}}}StaticFile {FilesMatch {* {pattern = .*.(dll|exe)headers {* = Content-Disposition: attachment}}}Extensions {css = text/cssgif = image/gifhtml = text/htmljpe = image/jpegjpeg = image/jpegjpg = image/jpegpng = image/pngtif = image/tifftiff = image/tifftxt = text/plain}}
其中,[OPENSHIFT_REPO_DIR], [OPENSHIFT_PHP_IP]和[OPENSHIFT_PHP_PORT]请通过echo $xxx或env查看
- 配置nginx,不知道为什么include的conf不会读,感觉是权限的问题?总之直接改 ~/nginx-hhvm/configuration/etc/nginx.conf。将原来的一行include改成
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758server {root [OPENSHIFT_REPO_DIR]www;listen [OPENSHIFT_PHP_IP]:[OPENSHIFT_PHP_PORT];server_name kagaku4-yoooo.rhcloud.com;index index.php index.html index.htm;set_real_ip_from [OPENSHIFT_PHP_IP];real_ip_header X-Forwarded-For;# avoid caching by proxiesadd_header Cache-Control private;if (-d $request_filename){rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;}location ~* \.(?:jpg|png|gif|css|js|swf|flv|ico) {# expires max;add_header Pragma no-cache;add_header Cache-Control "public, must-revalidate, proxy-revalidate, no-store";}if (-f $request_filename/index.html){rewrite (.*) $1/index.html break;}if (-f $request_filename/index.php){rewrite (.*) $1/index.php;}if (!-f $request_filename){rewrite (.*) /index.php;}# php file goes straigth to backendlocation / {#try_files $uri =404;fastcgi_pass unix:[OPENSHIFT_DATA_DIR]hhvm.sock;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;include openshift_params;# uncomment to export all environment variables to fastcgiinclude [OPENSHIFT_REPO_DIR]config/nginx.d/export_env;}# avoid unnecessary loglocation = /favicon.ico {access_log off;log_not_found off;}location = /robots.txt {access_log off;log_not_found off;}}
其中,[OPENSHIFT_REPO_DIR], [OPENSHIFT_PHP_IP]和[OPENSHIFT_PHP_PORT],[OPENSHIFT_DATA_DIR]请通过echo $xxx或env查看
- 重启应用rhc app stop -a appname && rhc app start -a appname或者在ssh里ctl_all restart
- 进入应用url,正常配置wordpress
需要注意的是,如果是搬家,导出sql之后记得把里面和原来主机有关的路径等替换掉
究竟hhvm能快多少我不知道的,至少没以前那么容易死了wwww
然后wp-supercache终于能用了,撸了个jae的cdn,感觉萌萌哒