Ubuntu+Apache+PHP+Mysql环境搭建(完整版)
-
Ubuntu+Apache+PHP+Mysql环境搭建(完整版)
一、操作系统
Ubuntu 14.04 64位,阿里云服务器二、Apache
1、安装Apache,安装命令:sudo apt-get install apache2
2、环境配置:
1)配置文件:路径为/etc/apache2,配置文件是apache2.conf,而没有http.conf。
2)默认网站根目录:/var/www/html,使用浏览器访问http://localhost 即可打开;
3)修改网站根目录:
A、“sudo vim /etc/apache2/apache2.conf"-->找到""的位置-->更改"/var/www/"为新的根目录“/home/www”即可
B、"sudo vi/etc/apache2/sites-available/000-default.conf"-->找到"DocumentRoot /var/www/html"的位置-->更改"/var/www/html"为新的根目录“/home/www”即可。
4)重启Apache服务器: sudo /etc/init.d/apache2 restart
三、PHP
1、更新源列表,否则安装php会失败:
命令行输入: vim /etc/apt/source.list
在最前面添加以下内容:
deb http://mirrors.aliyun.com/ubuntu/ precise main restricteduniverse multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-security mainrestricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-updates mainrestricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-proposed mainrestricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ precise-backports mainrestricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise mainrestricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-securitymain restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-updatesmain restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-proposedmain restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ precise-backportsmain restricted universe multiverse
apt-get update //更新一下列表
2、安装PHP,安装命令:sudoapt-get install php5
3、让Apache支持php,安装命令:sudo apt-get install libapache2-mod-php5
4、安装php5-gd模块,安装命令:sudoapt-get install php5-gd
5、让PHP支持curl
1)首先查看php5-curl是否已安装:dpkg -l | grep 'php5-curl'
2)如果没有安装,则:apt-get install php5-curl
3)确保 extension_dir存在,并且包含curl.so,
查找extension_dir:php -i | grep extension_dir
4)确保 /etc/php5/mods-available/curl.ini存在,文件内容如下:
; configuration for php CURL module
; priority=20
extension=curl.so
5)如果以上步骤均确定,重启服务器。
四、Mysql
1、安装Mysql,安装命令:sudoapt-get install mysql-server,安装过程中设置密码
2、允许root远程登录:
1)从所有主机:grant all privileges on *.* toroot@"%" identified by "passw0rd" with grant option;
2)can't connect to mysql server解决方法:修改配置文件,路径为/etc/mysql/my.cnf,注释掉bind-address = 127.0.0.0
即:#bind-address = 127.0.0.1
五、FTP
1、安装FTP,安装命令:sudoapt-get install vsftpd
2、查看是否安装成功:输入"sudo service vsftpdrestart"重启vsftpd服务
3、建立FTP目录: sudo mkdir/home/ftpfile/ftpfile
4、新建ftp用户: sudouseradd –d /home/ftpfile –s /bin/bash myftp
5、设置myftp用户密码: sudopasswd myftp ,输入两次密码
6、修改ftp配置文件,路径为/etc/vsftpd.conf,
1)配置修改如下:
anonymous_enable=NO
local_enable=YES
write_enable=YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
2)在/etc/目录中新建vsftpd.chroot_list文件,添加ftp用户名:myftp。或直接:
echo “myftp” >> /etc/vsftpd.chroot_list 即可。
六、SVN
1、安装SVN,安装命令:sudo apt-getinstall subversion
2、创建SVN工程:sudosvnadmin create /home/svn/kyssp
3、修改svn配置: vim /home/svn/kyssp_pub/conf/svnserve.conf
anon-access = read
auth-access = write
password-db = passwd
4、设置访问用户以及密码: 编辑文件vim /home/svn/kyssp_pub/conf/passwd
在最后一行添加:用户名 = 密码
5、启动svn:svnserve -d-r /home/svn/
6、使用SVN的post-commithooks 同步推送代码到生产环境
1)进入/home/svn/kyssp/hooks目录,cp post-commit.tmpl post-commit
2)在最后,添加如下:
REPOS="$1" REV="$2" #TXN_NAME="$3" WEB_PATH="/home/www/kyssp" #"$REPOS"/hooks/mailer.py commit "$REPOS"$REV "$REPOS"/mailer.conf #export LANG=zh_CN.UTF-8 export LANG=en_US.UTF-8 # #svn co --username zrs --password zrs@tzuo.cnsvn://112.74.**.**/kyssp_pub /home/www/kyssp svn update --username zrs --password zrs@tzuo.cn /home/www/kyssp 其中: svn co --username zrs --password zrs@tzuo.cnsvn://112.74.**.**/kyssp /home/software/www/kyssp 下载工程代码 svn update --username z** --password z*** /home/software/www/kyssp 更新工程代码
Ubuntu+Apache+PHP+Mysql环境搭建(完整版)的更多相关文章
- Ubuntu+Apache+PHP+Mysql环境搭建(完整版)(转)
http://www.2cto.com/os/201505/401588.html Ubuntu+Apache+PHP+Mysql环境搭建(完整版) 一.操作系统Ubuntu 14.04 64位,阿里 ...
- Ubuntu+Apache+PHP+Mysql环境搭建
一.操作系统Ubuntu 14.04 64位,虚拟机服务器 二.Apache 1.安装Apache,安装命令:sudo apt-get install apache2 2.环境配置: 1)配置文件:路 ...
- Apache+PHP+MySQL环境搭建
准备安装包:Apache: apache_2.2.11-win32.msi (http://pan.baidu.com/s/1nvdiNcH)PHP: php-5.2.5-Win32.zip (htt ...
- Ubuntu下PHP MySQL环境搭建-upcoming-ChinaUnix博客
编程语言选择php5 , web服务器选择Apache2 ,后台数据库选择MySQL首先安装编译工具, 打开终端 sudo apt-get install build-essential autoco ...
- Appium (win7系统)环境搭建----完整版
首先感谢 http://www.cnblogs.com/puresoul/p/4696638.html 和 http://www.cnblogs.com/fnng/p/4540731.html ...
- Appium环境搭建-完整版
环境依赖 Node.js Appium Appium-desktop Appium-doctor Appium-Python-Client Python JDK Andriod SDK 以上所需的软件 ...
- Apache+php+mysql环境配置
Apache+PHP+MySQL环境搭建 标题格式 正文格式 阶段性完成格式 正文中强调格式 ————————————————————————————— 前语:本文是从我写过的doc文档迁移过来的,由 ...
- Linux(Centos7)搭建LAMP(Apache+PHP+Mysql环境)
目录 Linux搭建LAMP(Apache+PHP+Mysql环境)Centos7 一. 检查系统环境 1.确认centos版本 2.检查是否安装过apache 3.检查是否安装过Mysql 4.清理 ...
- 一起学ASP.NET Core 2.0学习笔记(一): CentOS下 .net core2 sdk nginx、supervisor、mysql环境搭建
作为.neter,看到.net core 2.0的正式发布,心里是有点小激动的,迫不及待的体验了一把,发现速度确实是快了很多,其中也遇到一些小问题,所以整理了一些学习笔记: 阅读目录 环境说明 安装C ...
随机推荐
- JS实现——俄罗斯方块
把以下代码保存成Tetris.html文件,使用Google或360浏览器打开 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 4.0 Transit ...
- JavaScript日期时间格式化函数
这篇文章主要介绍了JavaScript日期时间格式化函数分享,需要的朋友可以参考下 这个函数经常用到,分享给大家. 函数代码: //格式化参数说明: //y:年,M:月,d:日,h:时,m分,s:秒, ...
- Selenium WebDriver-操作复选框
#encoding=utf-8 import unittest import time import chardet from selenium import webdriver class Visi ...
- Python IO多路复用select模块
多路复用的分析实例:服务端.客户端 #服务端配置 from socket import * import time import select server = socket(AF_INET, SOC ...
- andorid studio 环境搭建
1 安装jdk,配置jdk的环境变量http://www.cnblogs.com/liuhongfeng/p/4177568.html(通过java ,javac, java -version来察看j ...
- [python 函数学习篇]默认参数
python函数: 默认参数: retries= 这种形式 def ask_ok(prompt, retries=, complaint='Yes or no, please!'): while Tr ...
- April Fools Contest 2018
这个比赛不正经,但是我可以一本正经的写代码啊 A. Quirky Quantifiers time limit per test 2 seconds memory limit per test 64 ...
- POJ 1656 Counting Black
Counting Black Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 9772 Accepted: 6307 De ...
- Welcome-to-Swift-09类和结构体(Classes and Structures)
类和结构体是人们构建代码所用的一种通用且灵活的构造体.为了在类和结构体中实现各种功能,我们必须要严格按照对于常量,变量以及函数所规定的语法规则来定义属性和添加方法. 与其他编程语言所不同的是,Swif ...
- iOS学习笔记45-Swift(五)协议
一.Swift协议 协议是为方法.属性等定义一套规范,没有具体的实现,类似于Java中的抽象接口,它只是描述了方法或属性的骨架,而不是实现.方法和属性实现还需要通过定义类,函数和枚举完成. 1. 协议 ...