阿里雲Ubuntu系統從0搭建LAMP(Apache+MySQL+PHP)以及服務器生產環境常用配置 原

阿里雲 Ubuntu服務器操作的初始化工作

  • 1.百度下載SecureCRT.exe
  • 2.用SecureCRT進入你的服務器管理界面,賬號一般爲root,密碼爲你從阿里雲註冊購買時候的服務器密碼,如果不會使用SecureCRT請百度,so easy.

阿里雲 Ubuntu搭建LAMP(Apache+MySQL+PHP)

wget http://oss.aliyuncs.com/aliyunecs/update_source.tgz?spm=5176.775974184.2.4.ox8OHd&file=update_source.tgz

tar zxvf update_source.tgz?spm=5176.775974184.2.4.ox8OHd

bash update_source.sh

apt-get install yum

sudo apt-get install apache2

sudo apt-get install php5

sudo apt-get install libapache2-mod-php5

sudo /etc/init.d/apache2 restart

sudo apt-get install mysql-server

sudo apt-get install libapache2-mod-auth-mysql

sudo apt-get install php5-mysql

sudo /etc/init.d/apache2 restart

阿里雲 Ubuntu使用FTP管理您的網站文件上傳、下載

接下來是上傳下載文件,我們一般使用cuteftp,到百度下載去吧,so easy.

如下圖,選擇SFTP,進行SSH2來鏈接您的服務器

需要用到

  1. IP,你的服務器對外IP
  2. 賬號,一般爲root
  3. 密碼,您的服務器密碼

阿里雲 Ubuntu MYSQL可以允許遠程phpMyAadmin進行連接管理

mysql -u root -h localhost -p1234567890
use mysql;
update user set host='%' where user='root' and host='localhost';
flush privileges;

阿里雲 Ubuntu服務器 安裝URL Rewrite重寫模塊

sudo a2enmod rewrite
sudo vim /etc/apache2/sites-available/default【裏面的AllowOverride None 替換爲AllowOverride All
】
service apache2 restart

阿里雲 Ubuntu服務器 啓用虛擬目錄

/etc/apache2/httpd.conf【框架寫的系統,比如ZF2】
Alias /test "/var/www/test/public"
<Directory "/var/www/test/public">
	Options FollowSymLinks Indexes
	DirectoryIndex index.php
	AllowOverride All
	Order allow,deny
	Allow from all
</Directory>
service apache2 restart

切記,虛擬目錄要滿足2個條件

  • 1.可讀權限
  • 2.必須是全英文目錄名稱,不能爲中文名稱

否則,會報錯!

Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 Fatal error: Unknown: Failed opening required '/var/www/html/tt/index.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0

阿里雲 Ubuntu服務器 安裝php redis擴展

sudo apt-get install php5-dev

wget --no-check-certificate http://github.com/nicolasff/phpredis/tarball/master -O phpredis.tar.gz
tar phpredis.tar.gz
cd nicolasff-phpredis-94e0649
phpize
./configure
make
make install

php.ini添加extension=redis.so

service apache2 restart

阿里雲 Ubuntu服務器 安裝CURL擴展

sudo apt-get install php5-curl
service apache2 restart
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章