系统环境 阿里云1核+512M内存 Ubuntu 12.04 64位 Wordpress 3.9 修改系统软件源 参考http://mirrors.aliyun.com/help/ubuntu deb http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ pr
阿里云1核+512m内存 ubuntu 12.04 64位
wordpress 3.9
参考http://mirrors.aliyun.com/help/ubuntu
deb http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ precise-backports main restricted universe multiverse
若使用阿里云服务器,将源的域名从mirrors.aliyun.com改为mirrors.aliyuncs.com,不占用公网流量,而且下载速度更快。
sudo apt-get update && sudo apt-get upgrade
1、安装依赖软件
apt-get --install-suggests install gcc g++ make
2、下载相关软件
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz wget http://zlib.net/zlib-1.2.8.tar.gz wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz wget http://www.canonware.com/download/jemalloc/jemalloc-3.6.0.tar.bz2 wget http://tengine.taobao.org/download/tengine-2.0.2.tar.gz
3、安装Pcre
tar zxvf pcre-8.35.tar.gz cd pcre-8.35 ./configure --prefix=/usr/local/pcre-8.35 make && make install
4、安装Zlib
cd .. tar zxvf zlib-1.2.8.tar.gz cd zlib-1.2.8 ./configure --prefix=/usr/local/zlib-1.2.8 make && make install
5、安装OpenSSl
cd .. tar zxvf openssl-1.0.1g.tar.gz cd openssl-1.0.1g ./config --prefix=/usr/local/openssl-1.0.1g make && make install
6、解压jemalloc不需要安装
cd .. && tar jxvf jemalloc-3.6.0.tar.bz2
7、安装Tengine
飞蛙B2B2C(FeiWa B2B2C)商城系统是山东破浪网络科技有限公司于2017年最新推出的企业级B2B2C电商平台系统,采用PHP5+MySQL技术为基础,OOP(面向对象)方式进行核心框架搭建,结合MVC模式进行开发,可以支持Windows/Unix服务器环境,需PHP5.3及以上版本支持,可运行于包括Apache、IIS和Nginx在内的多种WEB服务器。飞蛙B2B2C(FeiWa B2
0
./configure --prefix=/usr/local/nginx \ --user=www-data \ --group=www-data \ --with-pcre=/usr/local/src/pcre-8.35 \ --with-zlib=/usr/local/src/zlib-1.2.8 \ --with-openssl=/usr/local/src/openssl-1.0.1g \ --with-jemalloc=/usr/local/src/jemalloc-3.6.0 \ --with-http_gzip_static_module \ --with-http_realip_module \ --with-http_stub_status_module \ --with-http_concat_module make && make install
其他系统参考https://github.com/facebook/hhvm/wiki
echo '140.211.166.134 dl.hhvm.com' >> /etc/hosts sudo apt-get install software-properties-common python-software-properties sudo add-apt-repository ppa:mapnik/boost wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add - echo deb http://dl.hhvm.com/ubuntu precise main | sudo tee /etc/apt/sources.list.d/hhvm.list sudo apt-get update sudo apt-get install hhvm
server hhvm start # 启动HHVM
如果想使用UNIX socket的方式启动HHVM,需要修改/etc/hhvm/server.ini
; php options pid = /var/run/hhvm/pid ; hhvm specific ;hhvm.server.port = 9000 hhvm.server.type = fastcgi hhvm.server.file_socket = /var/run/hhvm/hhvm.sock hhvm.server.default_document = index.php hhvm.log.level = Error hhvm.log.always_log_unhandled_exceptions = true hhvm.log.runtime_error_reporting_level = 8191 hhvm.log.use_log_file = true hhvm.log.file = /var/log/hhvm/error.log hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc hhvm.mysql.typed_results = false
配置nginx.conf,
#user nobody;
worker_processes auto;
worker_rlimit_nofile 100000;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 65535;
use epoll;
multi_accept on;
}
# load modules compiled as Dynamic Shared Object (DSO)
#
#dso {
# load ngx_http_fastcgi_module.so;
# load ngx_http_rewrite_module.so;
#}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
access_log off;
upstream hhvm {
server unix:/var/run/hhvm/hhvm.sock;
#server 127.0.0.1:9000;
}
server_tokens off;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 20m;
open_file_cache max=10000 inactive=5m;
open_file_cache_valid 2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
#gzip on;
include gzip.conf;
#vhost
include vhost_liuzhichao.com;
}
vim /etc/nginx/conf/gzip.conf
gzip on;
gzip_proxied any;
gzip_types text/css;
gzip_types text/csv;
gzip_types text/plain;
gzip_types text/javascript;
gzip_types application/javascript;
gzip_types application/json;
gzip_types application/x-javascript;
gzip_types application/ecmascript;
gzip_types application/xml;
gzip_types application/xml+rss;
gzip_types application/rss+xml;
gzip_types application/atom_xml;
gzip_types application/xhtml+xml;
gzip_types application/x-font-ttf;
gzip_types application/x-font-opentype;
gzip_types application/vnd.ms-fontobject;
gzip_types image/svg+xml;
gzip_types image/x-icon;
gzip_types text/xml;
gzip_comp_level 3;
gzip_http_version 1.1;
gzip_vary on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_buffers 16 8k;
gzip_min_length 20;
vim vhost_liuzhichao.com
server{
listen 80;
server_name liuzhichao.com www.liuzhichao.com;
root /var/www/liuzhichao.com;
index index.html index.htm index.php;
charset utf-8;
#access_log /var/log/nginx/liuzhichao.com-access.log main;
access_log /dev/null;
error_log /var/log/nginx/liuzhichao.com/error.log error;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ /wp-content/uploads/.*\.(php|php5)?$ {
deny all;
}
location = /favicon.ico {
log_not_found off;
access_log off;
expires max;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
#Browser Cache Control Directives
#Prevent (deny) Access to Hidden Files with Nginx
location ~ /\. {
access_log off;
log_not_found off;
}
# Cache static files for as long as possible
location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
expires max; log_not_found off; access_log off;
}
#The HHVM Magic Here
location ~ \.(hh|php)$ {
fastcgi_keep_conn on;
try_files $uri = 404;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass hhvm;
}
从目前的试用情况来看,查看阿里云监控,CPU占用率相对之前nginx+php-fpm架构低了不只是一点点,内存使用率也比较平稳.只是在上传文件或是更新插件时,经常会导致HHVM进程终止,然后网站出现502错误。不知道是不是因为上面的配置问题。
?
原文地址:在服务器搭建Tengine+HHVM环境运行WordPress, 感谢原作者分享。
全网最新最细最实用WPS零基础入门到精通全套教程!带你真正掌握WPS办公! 内含Excel基础操作、函数设计、数据透视表等
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号