先裝MySQL可能會好點php
安裝apache2html
sudo apt-get install apache2mysql
驗證:瀏覽器中輸入網址,顯示It Works!nginx
2.安裝php5sql
sudo apt-get install php5apache
安裝gd庫瀏覽器
sudo apt-get install php5-gd編碼
3.配置APACHE+PHPspa
sudo apt-get install libapache2-mod-php5rest
4:重啓apache
sudo /etc/init.d/apache2 restart 重啓
5:安裝MYSQL
sudo apt-get install mysql-server
6:讓apache,php支持mysql
sudo apt-get install libapache2-mod-auth-mysql
7:安裝MYSQL的php類庫
sudo apt-get install php5-mysql
8:再次重啓mysql
sudo /etc/init.d/apache2 restart
配置mysql的字符集
修改編碼方式
[mysql]
default-character-set=utf8
[mysqld]
character-set-server=utf8
隱藏Apache版本信息
在etc/apache2/apache2.conf最下面添加
ServerTokens Prod
而後再接着加載apache配置信息
sudo /etc/init.d/apache2 reload
這樣在Apache的404頁面下就沒有apache版本信息了
安裝nginx
下載源碼包
http://nginx.org/en/download.html 下載Stable版本
解壓進入
安裝依賴庫
sudo apt-get install libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev
./configure --with-http_ssl_module
make
sudo make install
啓動
sudo /usr/local/sbin/nginx (啓動)
/usr/local/sbin/nginx -s stop (中止)
/usr/local/sbin/nginx -s reload (重啓)
若是已經安裝了apache,最好在nginx目錄下的conf中的nginx.conf文件中修改端口
mysql -u root -p
mysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
註釋掉my.cnf中得bind
重啓mysql