linux(centos7) nginx php mysql安装
环境:
linux:centos7
php:7.0
基础命令
// yum install -y lrzsz // centos7 默认已安装
yum install epel-release
nginx安装
1.依赖包
yum install gcc
yum install pcre-devel
yum install zlib zlib-devel
yum install openssl openssl-devel //或者一键安装上面四个依赖
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
2.下载http://nginx.org/
3.配置、编译与安装
./configure \
--prefix=/usr/local/nginx \
--sbin-path=/usr/local/nginx/sbin/nginx \
--conf-path=/usr/local/nginx/conf/nginx.conf \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-pcre \
--lock-path=/var/run/nginx.lock \
--pid-path=/var/run/nginx.pid make && make install
4.关闭防火墙
// 命令都可以
service firewalld stop;
systemctl stop firewalld.service;
// centos从7开始默认用的是firewalld,这个是基于iptables的,虽然有iptables的核心,但是iptables的服务是没安装的。所以你只要停止firewalld服务即可:
sudo systemctl stop firewalld.service && sudo systemctl disable firewalld.service
如果你要改用iptables的话,需要安装iptables服务:
sudo yum install iptables-services
sudo systemctl enable iptables && sudo systemctl enable ip6tables
sudo systemctl start iptables && sudo systemctl start ip6tables
php安装
1.下载http://www.php.net/downloads.php,
2.安装依赖
yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel mysql pcre-devel curl
注意:安装php7beta3的时候有几处配置只是去,须要yum一下。如今php-7.0.2已经不用这样了。
# yum -y install curl-devel
# yum -y install libxslt-devel
3.配置、编译与安装
./configure --prefix=/usr/local/php \
--with-curl \
--with-freetype-dir \
--with-gd \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-pear \
--with-png-dir \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip make && make install
./configure --prefix=/usr/local/php \
--with-curl \
--with-freetype-dir \
--with-gd \
--with-gettext \
--with-iconv-dir \
--with-kerberos \
--with-libdir=lib64 \
--with-libxml-dir \
--with-mysqli \
--with-openssl \
--with-pcre-regex \
--with-pdo-mysql \
--with-pdo-sqlite \
--without-pear --disable-phar \
--with-png-dir \
--with-xmlrpc \
--with-xsl \
--with-zlib \
--enable-fpm \
--enable-bcmath \
--enable-libxml \
--enable-inline-optimization \
--enable-gd-native-ttf \
--enable-mbregex \
--enable-mbstring \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvsem \
--enable-xml \
--enable-zip make && make install
如果报错curl,则需要安装
cd /down
wget http://curl.haxx.se/download/curl-7.38.0.tar.gz
tar -xzvf curl-7.38..tar.gz
cd tar -xzvf curl-7.38..tar.gz
./configure --prefix=/usr/local/curl
make && make install // yum安装
yum install curl
配置文件
# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
# /etc/init.d/php-fpm
#location ~ \.php$ { 找到
# root html;
# fastcgi_pass 127.0.0.1:;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
location ~ \.php$ { 改为
root html;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
建立index.php 内容为
<?php
phpinfo()
?>
最后重启
service nginx restart 或者./nginx -s reload 重启nginx
service php-fpm restart 或者 /etc/init.d/php-fpm 重启 php-fpm
mysql安装
其它知识
firewalld使用
linux(centos7) nginx php mysql安装的更多相关文章
- linux中nginx、mysql安装碰到的问题
服务器到期新买了一台服务器,记录一下重新安装基本环境碰到了一些问题 安装nginx 1. 启动失败 403 forbidden nginx 解决方案:(个人使用直接用了root账号,修改对应nginx ...
- [转载]linux+nginx+python+mysql安装文档
原文地址:linux+nginx+python+mysql安装文档作者:oracletom # 开发包(如果centos没有安装数据库服务,那么要安装下面的mysql开发包) MySQL-devel- ...
- nginx + php + mysql安装、配置、自启动+redis扩展
用过了apache就想着用用nginx,网上教程其实很多,但是受服务器版本等限制,每个人遇到的问题也不一样,先记录下我的 一.安装依赖 yum -y install gcc zlib zlib-dev ...
- linux下nginx+php+mysql 自助环境搭建
++++++++++++++++++++++++++++++++++++++++++++++linux下nginx+php+mysql环境搭建+++++++++++++++++++++++++++++ ...
- Linux(CENTOS7) Nginx负载均衡简单配置
负载均衡的作用 1.转发功能 按照一定的算法[权重.轮询],将客户端请求转发到不同应用服务器上,减轻单个服务器压力,提高系统并发量. 2.故障移除 通过心跳检测的方式,判断应用服务器当前是否可以正常工 ...
- centos LAMP第一部分-环境搭建 Linux软件删除方式,mysql安装,apache,PHP,apache和php结合,phpinfo页面,ldd命令 第十九节课
centos LAMP第一部分-环境搭建 Linux软件删除方式,mysql安装,apache,PHP,apache和php结合,phpinfo页面,ldd命令 第十九节课 打命令之后可以输入: e ...
- Linux 系统 pptpd+radius+mysql 安装攻略
分类: 原文地址:Linux 系统 pptpd+radius+mysql 安装攻略 作者:wfeng .你所需要的软件 内核最好能升级到2.6 如果你是centos的用户,可以通过yum update ...
- LEMP--如何在Ubuntu上安装Linux、Nginx、MySQL和PHP
简介 LEMP是用来搭建动态网站的一组软件,首字母缩写分别表示Linux.Nginx(Engine-X).MySQL和PHP. 本文将讲述如何在Ubuntu安装LEMP套件.当然,首先要安装Ubunt ...
- linux centos7 nginx 安装部署和配置
1/什么是NginxNginx("enginex")是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP代理服务器,在高连接并发的情况下Nginx是Apac ...
随机推荐
- 用一颗学美术的心来理解PID调节
用一颗学美术的心来理解PID调节 泡利 3 个月前 相信大家小时候都画过美术作品吧?(什么?你还是宝宝?)没关系,不管你是文科.理科.工科.艺术还是家里蹲的,这篇文章对你来说一定会简单到爆炸的. 这种 ...
- tmux使用心得
1,在终端输入tmux命令进入tmux, control+b x,关闭tmux的初始化session 2,创建自己的session,然后进行分屏
- iOS11适配
链接: 你可能需要为你的 APP 适配 iOS 11 iOS11新特性,如何适配iOS11 App界面适配iOS11(包括iPhoneX的奇葩尺寸) iOS 11 安全区域适配总结 iOS 11 sa ...
- EasyUI学习总结(二)——easyloader分析与使用(转载)
本文转载自:http://www.cnblogs.com/haogj/archive/2013/04/22/3036685.html 使用脚本库总要加载一大堆的样式表和脚本文件,在easyui 中,除 ...
- eclim CSearch macro 问题的解决过程备忘录
问题: CSearch 宏时. RuntimeException: Could not find file with URI because it is a relative path, and no ...
- 你的项目真的需要Session吗? redis保存session性能怎么样?
在web开发中,Session这个东西一直都很重要,至少伴随我10年之久, 前一段时间发生一个性能问题,因为Redis session 问题,后来想想 其实我的项目session 是不需要的. 先看看 ...
- iOS开发-命令模式
命令模式算是设计模式中比较简单的,最常见的例子是工作任务安排下来进行编程,如果工作任务不需要完成,我们可以取消我们之前完成的代码,也可以理解为回滚撤销操作.这里面涉及到命令模式中的两个对象,一个是动作 ...
- 【工具】使用markdown写ppt
见识到一个新工具,markdown写ppt,支持多平台:https://yhatt.github.io/marp/ 看起来是一个不错的小工具,有兴趣可以尝试一下.
- linux网络设备—PHY
一.结构体 1.PHY设备 struct phy_device { struct phy_driver *drv; //PHY设备驱动 struct mii_bus *bus; //对应的MII总线 ...
- grid - 初识
Grid有三个参数 目前介绍以下两种:grid.inline-grid <view class="grid"> <view class='grid-row'> ...