64MB内存VPS安装Lighttpd/SQLite/PHP搭建WordPress博客教程
简介
当大佬们买了一台64MB/128MB小内存的VPS会干什么?SS?不,我们可以用它来建站。目前,此类小内存的VPS还很多有卖的,这里我用的OvzLa给大家演示
8月29日更新:由于FasterVM&OvzLa跑路,将演示站点更换到咖啡主机192 MB内存的VPS上
系统要求
系统为Debian 6 32位,其他系统自测
安装过程
1、升级和精简Debian系统
apt-get update&&apt-get upgrade #升级系统源 apt-get -y purge apache2-* bind9-* xinetd samba-* nscd-* portmap sendmail-* sasl2-bin #删除多余不用的软件 apt-get -y purge lynx memtester unixodbc python-* odbcinst-* sudo tcpdump ttf-* #删除多余的组件 apt-get autoremove && apt-get clean #清理缓存文件 reboot #重启VPS
2、安装Lighttpd,SQLite和PHP
A - 安装系统必须要的环境和组件
apt-get install sqlite #安装sqlite apt-get install lighttpd #安装lighttpd apt-get install php5-cgi php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-mhash php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl #安装PHP
B - 修改PHP配置文件
vi /etc/php5/cgi/php.ini
找到cgi.fix_pathinfo这一行,取消前面的 ; 并将1改为0(建议下载下来修改后上传)
C - 建立WWW单独用户
useradd -d /home/wwwroot -m -s /bin/bash www
D - 修改Lighttpd配置文件(/etc/lighttpd/lighttpd.conf)全部替换成下面的内容
server.modules = ( "mod_access", "mod_alias", "mod_compress", "mod_redirect", "mod_rewrite", "mod_fastcgi", ) server.document-root = "/var/www" server.upload-dirs = ( "/var/cache/lighttpd/uploads" ) server.errorlog = "/var/log/lighttpd/error.log" server.pid-file = "/var/run/lighttpd.pid" server.username = "www" server.groupname = "www" index-file.names = ( "index.php", "index.html", "index.htm", "default.htm", " index.lighttpd.html" ) url.access-deny = ( "~", ".inc" ) static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) include_shell "/usr/share/lighttpd/use-ipv6.pl" dir-listing.encoding = "utf-8" server.dir-listing = "enable" compress.cache-dir = "/var/cache/lighttpd/compress/" compress.filetype = ( "application/x-javascript", "text/css", "text/html", "text/plain" ) include_shell "/usr/share/lighttpd/create-mime.assign.pl" include_shell "/usr/share/lighttpd/include-conf-enabled.pl" fastcgi.server = ( ".php" => (( "bin-path" => "/usr/bin/php5-cgi", "socket" => "/tmp/php.socket", "max-procs" => 1, "bin-environment" => ( "PHP_FCGI_CHILDREN" => "4", "PHP_FCGI_MAX_REQUESTS" => "1000" ), )))
E - 设置Lighttpd拥有者权限和重启Lighttpd
chown -R www:www /var/log/lighttpd /etc/init.d/lighttpd restart
3、添加站点
1、手工添加站点目录。注意替换域名
mkdir -p /home/wwwroot/mjj.buzz mkdir -p /home/wwwroot/mjj.buzz/public
2、修改目录所有权。
chown www:www /home/wwwroot/mjj.buzz/public
3、lighttpd日志目录存放所有权。
chown -R www:www /var/log/lighttpd
4、配置lighttpd.conf文件设定站点。参考本站,以一段为添加站点,第二段为@跳转www
$HTTP["host"] =~ "^(www.mjj.buzz|mjj.buzz)$" { server.document-root = "/home/wwwroot/mjj.buzz/public" accesslog.filename = "/var/log/lighttpd/mjj.buzz/access.log" server.error-handler-404 = "/404.html" } $HTTP["host"] =~ "^mjj.buzz$" { url.redirect = ( "^/(.*)" => "http://www.mjj.buzz/$1" ) }
5、重启lighttpd使配置生效
/etc/init.d/lighttpd restart
4、安装WordPress
1、下载并解压WordPress文件:
apt-get install unzip cd /home/wwwroot/mjj.buzz/public wget http://cn.wordpress.org/latest-zh_CN.zip unzip *.zip mv wordpress/* ./ rm -rf *.zip wordpress
2、因为WP不支持SqLite为了让WordPress支持SQLite数据库,需安装插件SQLite Integration:
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
3、修改WordPress配置文件:
cp wp-config-sample.php wp-config.php vi wp-config.php
4、把下面几行注释或删除掉:
define('DB_NAME', 'database_name_here'); define('DB_USER', 'username_here'); define('DB_PASSWORD', 'password_here'); define('DB_HOST', 'localhost');
5、替换或添加上:
define('DB_FILE', '64mb'); define('DB_DIR', '/home/wwwroot/mjj.buzz/public/db');
6、修改权限
chown -R www /home/wwwroot/mjj.buzz/public chmod -R 755 /home/wwwroot/mjj.buzz/public
7、打开你的域名,即可看到熟悉的界面
8、因性能原因,速度可能比较慢
9、成功进入后台
参考站点(可乐制作)
https://www.MJJ.Buzz/
安装完成之后,建议大家重启一下,探针地址:你猜啊。
本文参考自:64mb.win 老蒋部落
十佳人物