debian 7 上安裝lamp

平臺:debian 7 x86_64php

1、準備html

apt-get update
apt-get upgrade -y --show-upgradedmysql

 

2、安裝mysqlweb

apt-get install -y mysql-server mysql-clientsql

mysql_secure_installationapache

service mysql startvim

配置文件位置/etc/mysql/my.cnfcurl

 

mysql -u rootsocket

mysql> USE mysql;ide

mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE user='root';

mysql> FLUSH PRIVILEGES;

 

3、安裝apache和php

apt-get install -y apache2 php5 php5-gd php5-common php5-intl php5-xmlrpc php-pear php5-mysql php5-curl libcurl3 libapache2-mod-php5 php5-mcrypt php5-mhash php5-xcache vim vim-runtime

sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php5/apache2/php.ini

sed -i 's/post_max_size = 8M/post_max_size = 32M/g' /etc/php5/apache2/php.ini

sed -i 's/expose_php = On/expose_php = Off/g' /etc/php5/apache2/php.ini

sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 20M/g' /etc/php5/apache2/php.ini

sed -i 's/;date.timezone =/date.timezone = PRC/g' /etc/php5/apache2/php.ini

sed -i 's/max_execution_time = 30/max_execution_time = 120/g' /etc/php5/apache2/php.ini

sed -i 's/disable_functions =.*/disable_functions = passthru,exec,system,chroot,scandir,chgrp,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server/g' /etc/php5/apache2/php.ini
 

vi /etc/apache2/apache2.conf

Timeout 120
KeepAlive Off

<IfModule mpm_prefork_module>
  ServerLimit 1000
  StartServers 5
  MinSpareServers 5
  MaxSpareServers 10
  MaxClients 1000
  MaxRequestsPerChild 10000
</IfModule>


mkdir -p /var/www/html
chown www-data:www-data -R /var/www/html
echo "<?php phpinfo(); ?>" > /var/www/html/index.php

vi /etc/apache2/sites-available/default

ServerName 127.0.0.1
<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/html/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/html/>
                Options FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

sed -i 's/ServerTokens OS/ServerTokens Prod/g' /etc/apache2/conf.d/security

sed -i 's/ServerSignature On/ServerSignature Off/g' /etc/apache2/conf.d/security

echo 'AddDefaultCharset GB2312' >> /etc/apache2/conf.d/charset

service apache2 restart

http://yourserverip/ 便可看到php的信息頁

4、安裝phpmyadmin

apt-get install -y phpmyadmin

ehco 'Include /etc/phpmyadmin/apache.conf' >> /etc/apache2/apache2.conf

 

service apache2 restart

http://yourserverip/phpmyadmin

配置多站點

cp /etc/apache2/sites-available/default /etc/apache2/sites-available/site1 修改site1的內容,網站根目錄等 創建軟鏈接 ln -s /etc/apache2/sites-available/site1 /etc/apache2/sites-enabled/site1  

相關文章
相關標籤/搜索