ubuntu下LAMP环境安装详细教程

2020-02-03 11:05:02丽君

创建cache缓存目录


eaccelerator.cache_dir="/var/cache/eaccelerator"   这里定义cache路径

默认值是/tmp/eaccelerator,这非常简单因为任何人都对该目录可写,但是并不明智,因为重启后系统会自动清理该目录。一个更好的地方是/var/cache/eaccelerator。创建该目录并确保它对eAccelerator的使用者可写(通常该用户是你的网络服务器运行者,可能是www-data)。 使用默认值的话这样继续:


mkdir /tmp/eaccelerator

chmod 777 /tmp/eaccelerator

改成 /var/cache/eaccelerator的话这样继续,先改php.ini


eaccelerator.cache_dir="/var/cache/eaccelerator"

sudo mkdir /var/cache/eacceleratorsudo chown root:www-data /var/cache/eacceleratorsudo chmod u=rwx,g=rwx,o= /var/cache/eaccelerator

复制控制文件control.php到网站根目录


sudo cp control.php /var/www/htdocs/

修改control.php的$user和$pw,默认是admin和eAccelerator


sudo vi /var/www/htdocs/control.php

重启apache


sudo /etc/init.d/apache2 restart

打开 http://localhost/control.php

查看之前的info.php页面,有下列字段:


This program makes use of the Zend Scripting Language Engine:Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies    with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator

安全

隐藏服务器信息


vim /etc/apache2/apache2.confServerTokens Prod

指定apache2的运行账户

以root来运行是很危险的,用下面的方法更改,这里是都改为www-data


vim /etc/apache2/envvarsexport APACHE_RUN_USER=www-dataexport APACHE_RUN_GROUP=www-data

要确认存在这些用户组。

启用.htaccess

这个对pbpbb3这样有附带.htaccess的程序有利,不过其它场合有可能引发问题。 方法:在网站主机配置下加入AllowOverride AuthConfi 例子:


vim /etc/apache2/sites_available/default<Directory /var/www/>...AllowOverride AuthConfig...</Directory>

其他

PDO的安装


pecl search pdo