有你在真好 的个人博客
小内存VPS建站-安装PHP-Lighttpd-SQLite
阅读:2211 添加日期:2021/3/30 17:49:43

搬瓦工VPS已经在上一篇文章中针对256MB内存方案的VPS主机安装Debian系统环境,以及更新最新源以及删除不必要的组件,可以更优的降低资源占用率。这样在这篇文章中我们需要开始安装WEB环境,我们一般可能常见Nginx或者Apache架构,但是这两者的占用资源都比较大,我们可以采用LiteSpeed或者Lighttpd,前者我发现编译经常出现错误,所以我采用Lighttpd这样更省资源一些。

同时,数据库不准备使用MYSQL,而用占用资源少的SQLite数据库,既然准备用小内存VPS主机,所以我们考虑数据库也是关键,比如ZBLOG、TYPECHO程序是我们后面需要选择的,占用资源较小,这个我们后期在讨论,同时,PHP肯定需要安装的。

第一、安装SQLite

apt-get install sqlite -y

第二、安装Lighttpd

apt-get install lighttpd -y

第三、安装PHP以及其他组件

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 -y

第四、配置/etc/php5/cgi/php.ini文件

找到cgi.fix_pathinfo字符,然后前面的备注取消,然后检查是不是参数1。

第五、添加站点目录

useradd -d /home/wwwroot -m -s /bin/bash www

这里我们需要给站点添加一个目录,然后把站点文件到时候可以传上去。

第六、修改
/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"

),

)))

我们把上面文件中的文件都替换掉。

第七、修改权限

chown -R www:www /var/log/lighttpd

/etc/init.d/lighttpd restart

修改权限后重启Lighttpd,这样站点环境就安装完毕。后面我们就可以开始传数据。

本文来自:
http://www.banwagongvps.com/194.html

ICP备案号:苏ICP备14035786号-1 苏公网安备 32050502001014号