LNMP安装

4 篇文章 0 订阅
4 篇文章 0 订阅

Setting up WordPress + Nginx + HHVM For The Fastest Possible Load Times
Use LAMP to set up website became most popular of all structure , but when i run it on my vps with 512MB ram and only when i open one web page and then my ram is run out of . So i had to find a efficient structure to setup my website and then i found that , which is NGINX + Mysql + PHP +HHVM. Someone said use this structure , 512MB RAM can run 4-5 wordpress but i haven’t try .

HHVM is an open-source virtual machine designed for executing programs written in Hackand PHP. HHVM uses a just-in-time (JIT) compilation approach to achieve superior performance while maintaining the development flexibility that PHP provides.

Oh , here’s my hardware and system on my vps :

10 GB SSD
512 MB RAM
1x Intel Xeon cpu
ubuntu 15.04 minimal system

That’s right ,it is bandwagonhost.com . Now ,let’s start .

Because i was in root user ,so the command i haven’s type “sudo” ,but if you are not in root user you need to add sudo before all your command .

First of all , you need to remove apache because we use nginx to replace it because in some kind nginx is more efficient than apache but nginx can’t Completely replaced apache !!!!!! So run :

apt-get purge apache*;

After that , i will type apt rather than apt-get but i hope you know whether your machine support apt or only support apt-get .

And then we need to install nginx ,so run :

    • apt-get update;
    • apt-get upgrade -y;
    • apt-get install -y python-software-properties software-properties-common;
    • add-apt-repository ppa:nginx/stable;
    • apt-get update;
    • apt-get install -y nginx-extras;

Ok ,now nginx is installed , and then we need to install hhvm and here’s ubuntu 12.04 and ubuntu 14.04 ‘s instruction , also we can follow official guide .

Ubuntu 12.04:
$ sudo add-apt-repository -y 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 -y hhvm<
Ubuntu 14.04:
$ wget -O – http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add –
$ echo deb http://dl.hhvm.com/ubuntu trusty main | sudo tee /etc/apt/sources.list.d/hhvm.list
$ sudo apt-get update
$ sudo apt-get install -y hhvm

So far, everything goes pretty smoothly. The longest part is probably waiting for the server to pull in all of the packages for the ‘apt-get update’ every time.

After installing HHVM, we get a pretty handy message.

********************************************************************
* HHVM is installed. Here are some more things you might want to do:
*
* Configure your webserver to use HHVM:
* $ sudo /usr/share/hhvm/install_fastcgi.sh
* $ sudo /etc/init.d/nginx restart
* $ sudo /etc/init.d/apache restart
* $ sudo /etc/init.d/hhvm restart
*
* Start HHVM at boot:
* $ sudo update-rc.d hhvm defaults
*
* Run command line scripts with HHVM:
* $ hhvm whatever.php
*
* Use HHVM for /usr/bin/php even if you have php-cli installed:
* $ sudo /usr/bin/update-alternatives –install /usr/bin/php php /usr/bin/hhvm 60
********************************************************************
This is nice because we only need to follow the
instruction .run:

  •  /usr/share/hhvm/install_fastcgi.sh

After this fast install ,we need to add hhvm on system start :

  • update-rc.d hhvm defaults

And then we should restart hhvm

  • service hhvm restart ;

At this time , we need to test hhvm and run :

    • touch test.php

 

    • echo ” >> test.php

 

  • hhvm test.php

 

If only something you received rather than error , that means
hhvm is OK .
And then , we have the last instruction when we install hhvm
and display , run :

  •  /usr/bin/update-alternatives –install /usr/bin/php php /usr/bin/hhvm 60

By this , we made HHVM pretend to be PHP over the command line.
And we have to test php by running :

  • php -v ;

Now ,we had installed all software we need ,and the next is
edit the configurations to make them run correct.

Here ‘s some thing we need to know :
The default file location of our web files is “/var/www/html” ,
and when we browser localhost maybe we will got apache2’s page ,
if so , you need to check if your apache2 not be removed and you need to
completely remove it and redo something. But if you don’t have apache in machine
you just need to remove index* from “/var/www/html”.

  • rm -f /var/www/html/index*

Important thing to say three times:
All the command were executed on root user , if your are not root user ,
please add sudo!!!

At this time we need to install Mysql ,after type the following command
and we will get a password screen to set our root password :

  •  apt install mysql-server ;

Now we can install wordpress :

  •  cd /var/www/html
  •  wget ” http://wordpress.org/latest.zip
  •  unzip latest.zip
  •  mv wordpress/*
  •  rmdir wordpress
  •  rm latest.zip
  •  rm index.html

Now we need setup Mysql database :

  •  mysql -u root -p

And then we should create a database which wordpress will use it .Type :

  •  create database wordpress ;
  •  exit ;

***Do not forgot the “;” in mysql , if you lose “;” ,the command can not be executed !!!

And now we need to create wp-config.php :

  •  cp wp-config-sample.php wp-config.php;

Now we need to edit some configuration , that ‘s the most difficult part maybe ,if you encounter some errors and you can not solve it by your self ,you can email and communicate with me or you can google it .

  •  vim /etc/nginx/sites-avaliable/default

we need to change this line to be this :

index index.php index.html index.htm;

and “try_files “change to :
try_files $uri $uri/ /index.php$is_args$args ;

Then restart nginx :

  • service nginx restart ;

Oh right , Maybe you need vsftpd if you install plugins
to wordpress , for that you can follow my next blog .


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安装 Zabbix 前需要确保已经安装LNMP 环境。如果你还没有安装 LNMP,可以参考以下文章进行安装LNMP 安装教程:https://blog.csdn.net/qq_34827705/article/details/79450480 接下来,开始安装 Zabbix: 1. 下载 Zabbix 安装包 进入 Zabbix 官网下载页面,选择需要的版本并下载:https://www.zabbix.com/download 2. 解压安装包 将下载好的安装包上传到服务器上,使用 tar 命令解压缩: ``` tar zxvf zabbix-xxx.tar.gz -C /usr/local/src ``` 3. 配置 Zabbix 服务端 进入解压后的 zabbix 目录,进入到 server 子目录,执行 configure 命令生成 Makefile 文件: ``` cd /usr/local/src/zabbix-xxx cd server ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl ``` 执行 make 命令编译: ``` make && make install ``` 4. 配置 Zabbix 数据库 进入到 Zabbix 数据库文件夹,执行以下命令: ``` cd /usr/local/src/zabbix-xxx/database/mysql mysql -u root -p ``` 输入密码进入 MySQL 控制台,创建 Zabbix 数据库和用户: ``` CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin; GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'password'; FLUSH PRIVILEGES; QUIT; ``` 5. 导入 Zabbix 数据库结构 进入到 Zabbix 数据库文件夹,执行以下命令: ``` cd /usr/local/src/zabbix-xxx/database/mysql mysql -u zabbix -p zabbix < schema.sql mysql -u zabbix -p zabbix < images.sql mysql -u zabbix -p zabbix < data.sql ``` 6. 配置 Zabbix Web 界面 进入 Zabbix 解压后的根目录,进入到 frontends/php 目录,将配置文件模板复制一份并重命名为 zabbix.conf.php: ``` cd /usr/local/src/zabbix-xxx/frontends/php cp conf/zabbix.conf.php.example conf/zabbix.conf.php ``` 打开 zabbix.conf.php 文件,修改以下内容: ``` $DB['TYPE'] = 'MYSQL'; $DB['SERVER'] = 'localhost'; $DB['PORT'] = '3306'; $DB['DATABASE'] = 'zabbix'; $DB['USER'] = 'zabbix'; $DB['PASSWORD'] = 'password'; ``` 7. 配置 Nginx 在 Nginx 的配置文件中添加以下内容: ``` server { listen 80; server_name zabbix.example.com; root /usr/local/src/zabbix-xxx/frontends/php; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php?$args; } 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; } } ``` 修改 server_name 为你的域名或 IP 地址。 8. 启动 Zabbix 服务 启动 Zabbix 服务: ``` /usr/local/zabbix/sbin/zabbix_server ``` 启动 Zabbix Web 界面: ``` /usr/local/zabbix/sbin/zabbix_agentd ``` 9. 访问 Zabbix 在浏览器中访问 Zabbix Web 界面:http://zabbix.example.com 输入默认用户名和密码:Admin/zabbix,即可进入 Zabbix 系统。 以上就是 LNMP 安装 Zabbix 的过程,希望对你有所帮助!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值