CentOS 搭建LNMP服务器和LAMP服务器
CentOS 搭建LNMP服务器
方法一:yum安装
1、更新YUM源
wget http://www.atomicorp.com/installers/atomic #下载atomic自动更新YUM源
sh atomic #安装atomic自动更新YUM源
yum check-update #检查可更新的程序
2、将80端品加入防火墙
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT #将80端口加入
service iptables save #保存iptables
/etc/init.d/iptables restart #重启iptables
3、安装nginx
yum install nginx #用YUM安装nginx
service nginx start #启动nginx
chkconfig nginx on #将nginx加入开机启动
4、安装PHP
yum install php
5、安装PHP扩展:
yum -y install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt php-cli php-pdo php-tidy php-pecl-memcache
6、然后安装PHP-FPM来运行PHP
yum install php-fpm
7、安装mysql数据库
yum install mysql-server #安装mysql数据库
yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql #安装连接扩展
8、配置nginx支持PHP
(1)vi /etc/php.ini
最后面加入下面两行
gi.force_redirect = 1
cgi.fix_pathinfo=1
(2)vi /etc/nginx/conf/default.conf
location ~ \.php$ {
root /usr/share/nginx/html; (注:这里是网站的目录路径)
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
(注:上面一名需要修改为)
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
9、MYSQL默认root密码为空,所以需要对新安装的MYSQL进行密码设置、删除匿名用户,是否开启root的远程权限和删除默认的Test数据库。
/usr/bin/mysql_secure_installation
10、其实的一些文件权限设置
修改/etc/php-fpm.conf 用户组为nginx
chown nginx:nginx /etc/php-fpm.conf
修改/var/lib/php/session(使php能保存session)
chown -R nginx:nginx /var/lib/php/session
chown -R root:root /var/lib/php/session
chmod -R 777 /var/lib/php/session
11、启动、停止、重启Nginx、php-fpm 、MySQL:
service nginx start (start|stop|restart|reload)
service php-fpm start (start|stop|restart)
service mysqld start (start|stop|restart|reload)
12、设置Nginx、php-fpm 、MySQL开机自动启动:
chkconfig nginx on
chkconfig php-fpm on
chkconfig mysqld on
CentOS 搭建LAMP服务器
方法一:yum安装
1、更新YUM源
wget http://www.atomicorp.com/installers/atomic #下载atomic自动更新YUM源
sh atomic #安装atomic自动更新YUM源
yum check-update #检查可更新的程序
2、将80端品加入防火墙
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT #将80端口加入
service iptables save #保存iptables
/etc/init.d/iptables restart #重启iptables
3、安装Apache WEB服务器:
yum install httpd #用YUM安装Apache
service httpd start #启动Apache
chkconfig httpd on #将Apache加入开机启动
4、安装PHP
yum install php
5、安装PHP扩展:
yum -y install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt php-cli php-pdo php-tidy php-pecl-memcache
6、然后安装PHP-FPM来运行PHP
yum install php-fpm
7、安装mysql数据库
yum install mysql-server #安装mysql数据库
yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql #安装连接扩展
8、配置appache 支持PHP
(1)vi /etc/httpd/conf/httpd.conf
打开appache 的配置httpd.conf配置加入PHP
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
9、MYSQL默认root密码为空,所以需要对新安装的MYSQL进行密码设置、删除匿名用户,是否开启root的远程权限和删除默认的Test数据库。
/usr/bin/mysql_secure_installation
10、启动、停止、重启Nginx、php-fpm 、MySQL:
service nginx start (start|stop|restart|reload)
service php-fpm start (start|stop|restart)
service mysqld start (start|stop|restart|reload)
11、设置appache 、php-fpm 、MySQL开机自动启动:
chkconfig httpd on
chkconfig php-fpm on
chkconfig mysqld on
CentOS 搭建LNMP服务器和LAMP服务器的更多相关文章
- CentOS 6.3安装配置LAMP服务器(Linux+Apache+MySQL+PHP5)
服务器系统环境:CentOS 6.3 客户端系统环境:Windows 7 ultimate(x86)sp1 简体中文旗舰版 ※ 本文档描述了如何在Linux服务器配置Apache.Mysql.PHP ...
- CentOS 6.6安装配置LAMP服务器(Apache+PHP5+MySQL)
准备篇: CentOS 6.6系统安装配置图解教程 http://www.osyunwei.com/archives/8398.html 1.配置防火墙,开启80端口.3306端口 vi /etc/s ...
- CentOS 6.4安装配置LAMP服务器(Apache+PHP5+MySQL)
这篇文章主要介绍了CentOS 6.4安装配置LAMP服务器(Apache+PHP5+MySQL)的方法,需要的朋友可以参考下 文章写的不错,很详细:IDO转载自网络: 准备篇: 1.配置防火墙,开启 ...
- CentOS 7.0安装配置LAMP服务器(Apache+PHP+MariaDB)
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.service #停止fir ...
- CentOS 6.3安装配置LAMP服务器(Apache+PHP5+MySQL)
准备篇: 1.配置防火墙,开启80端口.3306端口 vi /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp -- ...
- CentOS 7.0 安装配置LAMP服务器方法(Apache+PHP+MariaDB)(转)
转自:http://www.jb51.net/os/188488.html 作者:佚名 字体:[增加 减小] 来源:osyunwei 准备篇: CentOS 7.0系统安装配置图解教程 http:/ ...
- CentOS 6.5安装配置LAMP服务器(Apache+PHP5+MySQL)的方法
CentOS 6.5安装配置LAMP服务器(Apache+PHP5+MySQL)的方法 准备篇: 1.配置防火墙,开启80端口.3306端口vi /etc/sysconfig/iptables-A I ...
- CentOS 6.4安装配置LAMP服务器
CentOS 6.4安装配置LAMP服务器(Apache+PHP5+MySQL) 作者: 字体:[增加 减小] 类型:转载 这篇文章主要介绍了CentOS 6.4安装配置LAMP服务器(Apache+ ...
- CentOS 5.11安装配置LAMP服务器(Apache+PHP5+MySQL)
http://www.osyunwei.com/archives/8880.html 准备篇: CentOS 5.x系统安装配置图解教程 http://www.osyunwei.com/archive ...
随机推荐
- [HDOJ1827]Summer Holiday(强连通分量,缩点)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1827 缩点后统计入度和当前强连通分量中最小花费,然后记录入度为0的点的个数和花费和就行了. /* ━━ ...
- git push
使用git push直接推送未关联分支的时候,出现如下提示: $ git push Counting objects: 46, done. Delta compression using up to ...
- 10 Useful du (Disk Usage) Commands to Find Disk Usage of Files and Directories
The Linux “du” (Disk Usage) is a standard Unix/Linux command, used to check the information of disk ...
- 高斯消元 分析 && 模板 (转载)
转载自:http://hi.baidu.com/czyuan_acm/item/dce4e6f8a8c45f13d7ff8cda czyuan 先上模板: /* 用于求整数解得方程组. */ #inc ...
- AWS 之 S3篇<.NET(c#)批量上传文件>
第一次知道AWS然后网上就研究了一番,如果也是第一次知道这个的话,或者对这个只知道是干什么,并没有写个相关的程序的话,可以看看这个网址http://docs.aws.amazon.com/zh_cn/ ...
- Qt之进程间通信(QProcess)
简述 QProcess可以在应用程序内部与其它进程通信,或启动其它应用程序.与在终端机之类的命令输入窗口上使用名称和参数是一样的,可以使用QProcess提供的函数start()启动进程.可以注册QS ...
- Java Servlet与Applet、CGI、JSP的比较
Java Servlet是一种独立于平台和协议的服务器端的Java应用程序,可以生成动态的Web页面. Java Servlet是位于Web 服务器内部的服务器端的Java应用程序,与传统的从命令行启 ...
- Android 调用系统的邮箱app发送邮件
第一种: String[] email = { "3802**92@qq.com" }; // 需要注意,email必须以数组形式传入 Intent intent = new In ...
- memcache的应用场景和实现原理
面临的问题 对于高并发高访问的 Web应用程序来说,数据库存取瓶颈一直是个令人头疼的问题.特别当你的程序架构还是建立在单数据库模式,而一个数据池连接数峰 值已经达到500的时候,那你的程序运行离崩溃的 ...
- AFNetworking教程
转:http://www.lanrenios.com/tutorials/network/2012/1126/527.html AFNETWORKING AFNetworking他是一个现在非常用得多 ...