Debian 8 Jessie LAMP server tutorial with Apache 2, PHP 5 and MariaDB
快速部署
apt-get update &&apt-get install -yapache2 php5 mysql-server php5-mysqlvim
service mysql restart
service apache2 restart
echo '' > /var/www/html/index.php
访问http://your_server_ip/index.php
详细部署:
安装Apache
apt-getinstall apache2
查看Apache是否安装成功
root@debian:~# apache2 -v
Server version: Apache/2.2.22 (Debian)
Server built: Aug 18 2015 09:49:50
安装php
root@debian:~# apt-get install php5
root@debian:~# php5 -v
PHP 5.4.45-0+deb7u2 (cli) (built: Oct 17 2015 08:26:31)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
查看Apache结合PHP模块
root@debian:~# cat /etc/apache2/mods-enabled/php5.load
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
安装MySQL PHP支持MySQL的模块
root@debian:~# apt-get install mysql-server
提示设定密码:chunli
root@debian:~# apt-get install php5-mysql
查看PHP加载MySQL状态:OK
root@debian:~# cat /etc/php5/mods-available/mysql.ini
; configuration for php MySQL module
; priority=20
extension=mysql.so
重启MySQL,apache
root@debian:~# service mysql restart
[ ok ] Stopping MySQL database server: mysqld.
[ ok ] Starting MySQL database server: mysqld ..
Checking for tables which need an upgrade, are corrupt or were
not closed cleanly..
root@debian:~# service apache2 restart
[ ok ] Restarting web server: apache2 ... waiting .
root@debian:~#
debian7的网页文件路径
root@debian:~# vim /var/www/index.php
mysql的配置文件-my.cnf:(路径:/etc/mysql/my.cnf)
apache2的配置文件-apache2.conf(路径:/etc/apache2/apache2.conf)
PHP的配置文件-php.ini:(路径:/etc/php5/apache2/php.ini)
debian8的网页文件路径
root@debian8:/var/www/html# ll /var/www/html/
total 4
-rw-r--r-- 1 root root 90 Mar3 20:57 index.php
页:
[1]