Ubuntu 14.10系統安裝 Nginx + MySQL + HHVM + phpMyAdmin環境

來源:互聯網
上載者:User

註:如果使用非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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.