平台centos 6.5 x86_64
1,安装epel源并更新系统
yum install -y epel-release
yum update -y
yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre pcre-devel
2,安装nginx
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
yum install -y nginx
3,安装hhvm
cd /etc/yum.repos.d
wget http://www.hop5.in/yum/el6/hop5.repo
cd
yum install -y hhvm
简单配置
vi /etc/hhvm/server.hdf
PidFile = /var/run/hhvm/pid
Server {
Port = 9000
Type=fastcgi
# File_socket = /var/run/hhvm/hhvm.sock
# SourceRoot = /var/www/
DefaultDocument = index.php
}
启动hhvm
hhvm --config /etc/hhvm/server.hdf --mode daemon
4,配置nginx
mkdir -p /var/www/html
chown -R nginx:nginx /var/www/html
cat > /etc/nginx/conf.d/default.conf<<-EOF
server {
listen 80;
server_name localhost;
root /var/www/html;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location / {
index index.html index.php index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css)$
{
expires 30d;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
EOF
cat > /etc/nginx/nginx.conf<<-EOF
user nginx;
worker_processes auto;
worker_rlimit_nofile 51200;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
multi_accept on;
}
http {
include /etc/nginx/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 /var/log/nginx/access.log main;
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 120;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
keepalive_timeout 20;
send_timeout 10;
client_header_timeout 10;
client_body_timeout 10;
gzip on;
gzip_buffers 16 8k;
gzip_min_length 1000;
gzip_comp_level 4;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml pplication/xml+rss text/javascript;
open_file_cache max=100000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
include /etc/nginx/conf.d/*.conf;
}
EOF
service nginx start
echo '<?php phpinfo(); ?>' > /var/www/html/index.php
ulimit -HSn 65535
cat >> /etc/security/limits.conf<<-EOF
* soft nofile 51200
* hard nofile 51200
EOF
http://yourserverip/即可看到hiphop说明ok
转载于:https://my.oschina.net/u/2404183/blog/740608