乐云主机笔记

  • 首页
  • 主机优惠
  • 学习记录
  • 新手教程
  • 自用主机
  • 资源下载
  • 网赚项目
  • 其他
  • pingtest

  1. 首页
  2. 新手教程
  3. 正文

在64M小内存VPS上安装Nginx+Sqlite+PHP+WORDPRESS

2017年8月14日 1829点热度 0人点赞 0条评论

想要在64M内存的VPS上安装LNMP环境并搭建wordpress网站可能性不大,安装MYSQL估计是瓶颈,所以参考网上各位大佬的教程,决定大家nginx+php+sqllie+wp的环境
系统:Debian 7.0 x86 minimal;
HTTP服务器:Nginx + PHP;
数据库:SQLite。
那么咱们就开始吧。

添加最新版本的源

也许随着时间的推移,安装的软件包版本会有所变化,本篇教程的设置可能有些不同。我这里安装之后的PHP版本为5.4,Nginx版本为1.8。

echo deb http://packages.dotdeb.org wheezy all >> /etc/apt/sources.list
echo deb-src http://packages.dotdeb.org wheezy all >> /etc/apt/sources.list
wget http://www.dotdeb.org/dotdeb.gpg
apt-key add dotdeb.gpg && rm dotdeb.gpg
apt-get update

安装软件包

apt-get install sqlite3
apt-get install nginx
apt-get install php5-fpm php5-curl php5-gd php5-imap php5-sqlite php5-xmlrpc

计划目录、配置文件

计划一下网站文件和数据库存放的目录:

mkdir -p /home/64mb/web
mkdir /home/64mb/db

添加虚拟主机配置文件:

1、vi /etc/nginx/sites-available/default
添加以下语句:

server {
    listen       80 default;
    server_name  _;
    return 500;

    location / {
        root   /home/64mb/web;
        index  index.html index.htm;
    }
}

2、vi /etc/nginx/sites-enabled/64mb.wp.conf
添加以下语句:

server {
    listen       80;
    server_name  64mb.letvps.com;

    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;
    access_log  /dev/null;

    location / {
        root   /home/64mb/web;
        index index.html index.htm index.php;
	try_files $uri $uri/ /index.php?$args;
    }

    rewrite /wp-admin$ $scheme://$host$uri/ permanent;

    location /home/64mb/db {
        deny all;
    }

    location ~ \.php$ {
        root           /home/64mb/web;
        fastcgi_pass   unix:/var/run/php5-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}

在第3行修改域名;在第10、22行修改站点文件目录;在第17行修改数据库文件目录。

重载Nginx:

nginx -t
nginx -s reload

配置PHP:
vi /etc/php5/fpm/php.ini
找到cgi.fix_pathinfo=1这一行,修改1为0,并去掉行首的分号。

vi /etc/php5/fpm/pool.d/www.conf
修改pm = dynamic为pm = static;

修改pm.max_children = 5为pm.max_children = 1。

重载PHP-FPM:

service php5-fpm restart

到这里Web环境就已经搭建了起来,且新建了一个虚拟主机。

安装WordPress

下载并解压WordPress文件:

apt-get install unzip
cd /home/64mb/web
wget http://cn.wordpress.org/latest-zh_CN.zip
unzip *.zip
mv wordpress/* ./
rm -rf *.zip wordpress

让WordPress支持SQLite数据库,插件SQLite Integration:

cd /home/64mb/web
wget https://downloads.wordpress.org/plugin/sqlite-integration.1.8.1.zip
unzip *.zip
mv sqlite-integration wp-content/plugins
cp wp-content/plugins/sqlite-integration/db.php wp-content
rm *.zip

修改WordPress配置文件:

cp wp-config-sample.php wp-config.php
vi wp-config.php

把下面几行注释或删除掉:

define('DB_NAME', 'database_name_here');
define('DB_USER', 'username_here');
define('DB_PASSWORD', 'password_here');
define('DB_HOST', 'localhost');

替换或添加上:

define('DB_FILE', '64mb');
define('DB_DIR', '/home/64mb/db');

重置站点目录、数据库目录用户和用户组:

chown -R www-data.www-data /home/64mb

浏览器中打开域名,填写博客名称等信息安装就可以了。

安装之后有下面的提示,无视之(默认已经在虚拟主机配置文件中做了安全配置):

Your webserver doesn't seem to be Apache. So the database directory access restriction by the .htaccess file may not function. We strongly recommend that you should restrict the access to the directory /home/64mb/db/ in some other way.
END..

不出意外你的WordPress程序就已经运行在64MB内存的VPS上了!

本文参考资料:https://64mb.win/howto/

标签: 暂无
最后更新:2017年8月14日

letvps

这个人很懒,什么都没留下

打赏 点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

分类
  • 主机优惠
  • 其他
  • 域名优惠
  • 学习记录
  • 新手教程
  • 网赚项目
  • 脚本源码
  • 自用主机
  • 资源下载
书签
  • AdvinServers.com
  • 猫云云计算

COPYRIGHT © 2021 Letcloud.cn. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

粤ICP备15031609号-3