转换为语音并朗读全文 00:00 / 00:00
注:如果使用非root权限,请在命令前面加上 sudo;

# 更新并升级
apt-get update && apt-get upgrade
# 安装 Nginx
apt-get install nginx -y
# 安装 Mysql
apt-get install mysql-server-5.6 -y
# 安装 HHVM
apt-get install hhvm -y
# 安装 PhpMyAdmin
apt-get install phpmyadmin -y
# 安装 进程守护
apt-get install ps-watcher -y
# 安装 FastCGI 配置脚本
/usr/share/hhvm/install_fastcgi.sh
# 自动配置 phpmyadmin
/usr/sbin/pma-configure .
/usr/sbin/pma-secure
# 通过:域名/phpmyadmin 访问
ln -s /usr/share/phpmyadmin /usr/share/nginx/html
# 将 hhvm 加入开机启动
update-rc.d hhvm defaults

# 编辑加入或替换 hhvm.conf
nano /etc/nginx/hhvm.conf

location ~ \.(hh|php)$ {
    fastcgi_keep_conn on;
    #fastcgi_pass   127.0.0.1:9000;
    fastcgi_pass   unix:/var/run/hhvm/sock;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

# 编辑加入或替换 php.ini
nano /etc/hhvm/php.ini

; php options
session.save_handler = files
session.save_path = /var/lib/php5
session.gc_maxlifetime = 1440

; hhvm specific 
hhvm.log.level = Warning
hhvm.log.always_log_unhandled_exceptions = true
hhvm.log.runtime_error_reporting_level = 8191
hhvm.mysql.typed_results = false

hhvm.enable_zend_compat = true

max_execution_time = 300
max_input_time = 60
post_max_size = 10M
upload_max_filesize = 10M
memory_limit = 512M
expose_php = 0

# 编辑加入或替换 server.ini
nano /etc/hhvm/server.ini

; php options

pid = /var/run/hhvm/pid

; hhvm specific 

; hhvm.server.port = 9000
hhvm.server.file_socket = /var/run/hhvm/sock
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.log.use_log_file = true
hhvm.log.file = /var/log/hhvm/error.log
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc

# 编辑加入或替换 ps-watcher.conf
nano /etc/ps-watcher.conf

[hhvm]
occurs = none
action = service hhvm restart

# 启用 ps-watcher
sed -i -e 's/# startup=1/startup=1/g' /etc/default/ps-watcher
# 编辑加入或替换 hhvm
nano /etc/init.d/hhvm

RUN_AS_USER="www"
RUN_AS_GROUP="www"

# 编辑加入或替换 nginx.conf
nano /etc/nginx/nginx.conf

user www www;
worker_processes auto;

# 增加 www 用户和用户组
groupadd www;
useradd -m -s /sbin/nologin -g www www;
# 更改所有者为 www
chown -R www.www /var/log/nginx
chown -R www.www /var/run/hhvm
chown -R www.www /var/log/hhvm
chown -R www.www /var/lib/phpmyadmin
chown -R www.www /usr/share/phpmyadmin
chown -R www.www /etc/phpmyadmin/
# 删除用户
userdel -r nginx
userdel -r www-data
# 启动
service nginx restart
service mysql restart
service hhvm restart
service ps-watcher restart

演示:http://106.185.54.103/wordpress/

探针1: http://106.185.54.103/ttttttz.php

探针2: http://106.185.54.103/pppppppppp.php

噗,这个linode vps 是麦葱用来测试玩的哦,以上地址可能会失效哦~

有人肯定会问了,有没有一键安装脚本啊!麦葱还没做,因为你不能让我做我就....(麦葱你是不是又要duang了!!!懒就明说嘛!!!)

如果你觉得文章不错,可以给点小小奖励~

微信

微信

支付宝

支付宝

带符号 * 的表示必填项
  1. projektant wnetrz
    projektant wnetrz

    I think this is one of the most important information for me.
    And i am satisfied reading your article. But want to
    observation on few common issues, The website style is wonderful,
    the articles is in reality nice : D. Good job, cheers

    回复
    1. MaiCong
      MaiCong博主

      Thank you for the compliment.

      回复
  2. hunden
    hunden

    I really love your blog.. Great colors & theme. Did you develop this website yourself?

    Please reply back as I'm hoping to create my own personal site and would love to
    know where you got this from or just what the theme is called.
    Thanks!

    回复
    1. MaiCong
      MaiCong博主

      Yes, I wrote it myself.

      回复
  3. 阿福
    阿福

    找时间我研究一下写个脚本。

    回复
  4. wordpress优化
    wordpress优化

    用的国外的包,512内存跑两个WP妥妥的

    回复
  5. hanbing17
    hanbing17

    高大上的东西

    回复
  6. TroanSun
    TroanSun

    文章写的很好很强大,HHVM速度确实很快,不过还是等待PHP7的问世....

    回复
  7. 上海装修
    上海装修

    原谅我一点都看不懂

    回复
  8. 时空镜像
    时空镜像

    过来看下老朋友,手动点32个赞! ;-)

    回复