Ubuntu 14.10 安装 Nginx + MySQL + HHVM + phpMyAdmin [LNMH]

注:如果使用非root权限,请在命令前面加上 sudo;

# 更新并升级
apt-get update && apt-get upgrade
# 安装 Nginx
apt-get install -y
# 安装 Mysql
apt-get install mysql-server-5.6 -y
# 安装 HHVM
apt-get install -y
# 安装 PhpMyAdmin
apt-get install myadmin -y
# 安装 进程守护
apt-get install ps-watcher -y
# 安装 FastCGI 配置脚本
/usr/share/hhvm/install_fastcgi.sh
# 自动配置 myadmin
/usr/sbin/pma-configure .
/usr/sbin/pma-secure
# 通过:域名/phpmyadmin 访问
ln -s /usr/share/phpmyadmin /usr/share//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了!!!懒就明说嘛!!!)