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,感覺萌萌噠
23333可是HHVM建WordPress有時會跳轉到8080端口而導致無法訪問……
好像是有這情況…sad
→_→博主有試過Scalable的HHVM配置嗎……
→_→沒,沒信用卡sad 【剛從垃圾評論里挖出來TAT
我按照github上那作者的方法加了一條,這兩天用着看看會不會蹦8080
JAE不穩定
你別說,靜態內容極其穩定
為什麼我不穩定呢
怎麼個不穩定?
上次還是看了你哪篇博客來着才知道的噗
Typecho輕的飛起
懶
不知道穩不穩定
比php5.6快且穩定是肯定的,只是512M內存的時候再跑一堆別的東西有可能會超內存被系統kill掉,其他問題暫時沒有發現
233,目測博主忘記改了kagaku4-yoooo.rhcloud.com;
古德,現在不用openshift了,鄰居太毒