centos 6.5 安装配置LAMP(linux,apache,mysql,php)环境
一、安装apahce 1、更新yum yum update 输入y更新 2、安装apache yum install httpd 输入y安装 3、可选择安装apache的帮助文档 yum install httpd-manual 访问文档:http://localhost/manual/howto/cgi 4、启动apache /etc/init.d/httpd start (restart:重
一、安装apahce
1、更新yum
yum update
输入y更新
2、安装apache
yum install httpd
输入y安装
3、可选择安装apache的帮助文档
yum install httpd-manual
访问文档:http://localhost/manual/howto/cgi
4、启动apache
/etc/init.d/httpd start (restart:重启) 或者 service httpd start (restart:重启)
启动之后会报错误:Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 10.171.202.8 for ServerName
可以忽略这个错误,也可解决,方法如下:
打开apache配置文件:vim /etc/httpd/conf/httpd.conf
找到 #ServerName www.example.com:80 改我自己的域名或者localhost 重启apache即可解决
5、开机启动apache
chkconfig httpd on
二、安装mysql
(
可用资源包:
http://centos.ustc.edu.cn/epel/6/x86_64/epel-release-6-8.noarch.rpm
http://rpms.famillecollet.com/enterprise/6/remi/x86_64/remi-release-6.5-1.el6.remi.noarch.rpm
)
1、选择版本:可自行去搜索第三方yum资源包
版本5.1.*:yum install mysql mysql-server mysql-devel
版本5.5.*:yum --enablerepo=remi install mysql mysql-server mysql-devel
2、启动mysql
/etc/init.d/mysqld start (restart:重启) 或者 service mysqld start (restart:重启)
3、开机启动mysql
chkconfig mysqld on
4、更改my.cnf文件
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf 如果存在直接覆盖
5、设置密码
安装好mysql后会自动设置一个密码主要安装信息
也可使用msyql_secure_installation:第一步按回车,之后输入两次密码,一直按Y即可
三、安装php
1、选择版本:可自行去搜索第三方yum资源包
版本5.3.*:yum install php php-mysql php-mcrypt php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc
版本5.4.*:yum --enablerepo=remi install php php-mysql php-mcrypt php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc
2、重启apache mysql
打开文件 vim /etc/httpd/conf/httpd.conf
这3项没用到,看到很多人写我也就加上了
KeepAlive Off 在76行
修改为:KeepAlive On (允许程序性联机)
Options Indexes FollowSymLinks 在331行 修改为:Options Includes ExecCGI FollowSymLinks(允许服务器执行CGI及SSI)
#AddHandler cgi-script .cgi 在796行 修改为:AddHandler cgi-script .cgi .pl (允许扩展名为.pl的CGI脚本运行)
这5项有用到
AllowOverride None 在338行 修改为:AllowOverride All (允许.htaccess)
AddDefaultCharset UTF-8 在759行 设置字符编码,按需配置
Options Indexes 配置域名时如果将 Indexes 删除:不在浏览器上显示树状目录结构
DirectoryIndex index.html index.html.var 在 402行 设置默认首页文件,增加index.php等
MaxKeepAliveRequests 100 在83行 修改为 1000 (增加同时连接数)
修改apache解析目录
DocumentRoot "/var/www/html" 修改为你的目录 "/data0/www/xxx" (这个目录就是挂载的数据盘)
rm -f /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html #删除默认测试页
Apache的日志文件
ErrorLog /etc/httpd/logs/error_log (php的错误日志也输出到这里)
CustomLog /etc/httpd/logs/access_log combined
php简单配置
打开配置文件 vim /etc/php.ini
date.timezone = PRC 把前面的分号去掉,改为date.timezone = PRC 中国时区
magic_quotes_gpc = On #在745行 打开magic_quotes_gpc来防止SQL注入 (php5.4开始不支持))
重启apache
关于apache php mysql的配置更多要自己去查阅相关资料

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Solution to permission issues when viewing Python version in Linux terminal When you try to view Python version in Linux terminal, enter python...

Causes and solutions for errors when using PECL to install extensions in Docker environment When using Docker environment, we often encounter some headaches...

Many website developers face the problem of integrating Node.js or Python services under the LAMP architecture: the existing LAMP (Linux Apache MySQL PHP) architecture website needs...

Using python in Linux terminal...

Configure the apscheduler timing task as a service on macOS platform, if you want to configure the apscheduler timing task as a service, similar to ngin...

Regarding the problem of removing the Python interpreter that comes with Linux systems, many Linux distributions will preinstall the Python interpreter when installed, and it does not use the package manager...

Multithreading in the language can greatly improve program efficiency. There are four main ways to implement multithreading in C language: Create independent processes: Create multiple independently running processes, each process has its own memory space. Pseudo-multithreading: Create multiple execution streams in a process that share the same memory space and execute alternately. Multi-threaded library: Use multi-threaded libraries such as pthreads to create and manage threads, providing rich thread operation functions. Coroutine: A lightweight multi-threaded implementation that divides tasks into small subtasks and executes them in turn.

To open a web.xml file, you can use the following methods: Use a text editor (such as Notepad or TextEdit) to edit commands using an integrated development environment (such as Eclipse or NetBeans) (Windows: notepad web.xml; Mac/Linux: open -a TextEdit web.xml)
