您的位置:首页 > 运维架构 > Apache

阿里云Ubuntu系统从0搭建LAMP(Apache+MySQL+PHP)以及服务器生产环境常用配置

2015-05-04 09:48 1456 查看

阿里云 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来链接您的服务器



需要用到

IP,你的服务器对外IP

账号,一般为root

密码,您的服务器密码

阿里云 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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息