V泡资源网起航第二步:安装Lighttpd,SQLite和PHP _ V泡网

技术文章

V泡资源网起航第二步:安装Lighttpd,SQLite和PHP

为了能在这迷你VPS上运行Typecho博客,当然得安装网站运行环境,最流行的apache已经在日益发展下变得臃肿起来,但是不用apache的话得自己写静态规则,这个对于很多人来书很难取舍啊,不过32MB的VPS已经是没得选择,直接上Lighttpd吧。

安装相关程序
1、连上SSH输入命令pstree,会出现类似下面的结果:

root@cal:/home/lighttpd/32mb# pstree
init-+-cron
|-dropbear
|-dropbear---dropbear---bash---pstree
|-kthreadd/2095---khelper/2095
|-lighttpd---php5-cgi---4*[php5-cgi]
|-sendmail-mta
2、接上一篇文章。精简完Debian后,下一步安装SQLite数据库

apt-get install sqlite
3、接着是Lighttpd

apt-get install lighttpd
4、最后安装PHP和相关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
修改配置
1、修改php.ini

nano /etc/php5/cgi/php.ini
2、Ctrl+w搜索,键入cgi.fix_pathinfo并回车,把cgi.fix_pathinfo = 0修改为cgi.fix_pathinfo = 1,也就是下面的样子

; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. $
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not $
; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Se$
; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A sett$
; of zero causes PHP to behave as before. Default is 1. You should fix your s$
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
; http://php.net/cgi.fix-pathinfo
cgi.fix_pathinfo = 1
3、接着新建一个专门用于运行Lighttpd的用户(安全),千万别用root,不然你会死得很惨的。

useradd -d /home/wwwroot -m -s /bin/bash www
4、然后修改Lighttpd的配置文件

nano /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"
),
)))
Ctrl+O保存,Ctrl+X退出。
5、修改日志目录的拥有者

chown -R www:www /var/log/lighttpd
6、重启Lighttpd

/etc/init.d/lighttpd restart
大功告成,此时网站环境配置完成,就差添加虚拟主机了。

(0)

本文由 V泡网 作者:Lefat 发表,转载请注明来源!

领券么

热评文章

评论:

1 条评论,访客:1 条,博主:0 条
  1. 支持您
    支持您发布于: 

    连续的!赞一个

发表评论

电子邮件地址不会被公开。 必填项已用*标注