Install NGINX, PHP-FPM (5.6) on CentOS 6
Installing NGINX with PHP on CentOS 6 can be a hassle depending on the install and packages you use.
We've made a short and easy guide to install a minimal NGINX web server with PHP-FPM (5.6) support ready to go.
This is beind done in a fresh CentOS 6.6 64-bit Minimal installation.
yum update -y
Once that's done install the latest Webtatic repository which holds our recommended PHP 5.6 and NGINX 1.8 packages:
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
yum install epel-release
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install nginx18 -y
Start the service and make it run after boot:
service nginx start
chkconfig nginx on
Now we can install PHP-FPM, we do not need the regular PHP package installed. If you need any modules such as MySQL, just do "yum install php56w-mysql":
yum install php56w-fpm -y
Start the service and run at boot:
service php-fpm start
chkconfig php-fpm on
Now we need to edit a part of the nginx.conf at /etc/nginx/nginx.conf. Look for the following section and change it accordingly to below (bolded text):
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
Uncomment the location section and edit the fastcgi_param script location from /scripts to our public directory like what is bolded below:
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
f#astcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
Save the nginx.conf file now once those are changed and restart nginx.
service nginx restart
Now lets make a phpinfo page to confirm that PHP is working correctly with Nginx and as an index page. Make a new "index.php" in the /usr/share/nginx/html/ directory with the following contents:
<?php
phpinfo();
?>
Save the file as "index.php" in /usr/share/nginx/html/, delete the index.html in the same directory, then visit the page in your web browser (http://your_server_ip/index.php). You should see the phpinfo() page with all of the information there like the screenshot below.
Create an IPTables firewall rule to allow access to port 80 (web server):
iptables -I INPUT 5 -p tcp -m tcp --dport 80 -j ACCEPT
service iptables save
yum install php56w-mbstring
yum install php56w-gd
yum install php56w-curl
yum install php56w-mysql
Done!
yum remove php*
yum remove php-*
yum remove php7
yum remove php70
yum remove php7.0
yum remove php-common
Install NGINX, PHP-FPM (5.6) on CentOS 6的更多相关文章
- [转载]How To Install Nginx And PHP-FPM On CentOS 6 Via Yum
http://www.lifelinux.com/how-to-install-nginx-and-php-fpm-on-centos-6-via-yum/ http://blog.csdn.net/ ...
- Install Nginx on CentOS 7
To set up the yum repository for RHEL/CentOS, create the file named /etc/yum.repos.d/nginx.repo with ...
- How To Install Linux, nginx, MySQL, PHP (LEMP) stack on CentOS 6
About Lemp LEMP stack is a group of open source software to get web servers up and running. The acro ...
- Centos 7下安装nginx,使用yum install nginx,提示没有可用的软件包
Centos 7下安装nginx,使用yum install nginx,提示没有可用的软件包. 18 (flaskApi) [root@67 flaskDemo]# yum -y install n ...
- How To Install Nginx on CentOS 7(转)
How To Install Nginx on CentOS 7 PostedJuly 22, 2014 427.4kviews NGINX CENTOS About Nginx Nginx is a ...
- Cenos7 编译安装 Mariadb Nginx PHP Memcache ZendOpcache (实测 笔记 Centos 7.0 + Mariadb 10.0.15 + Nginx 1.6.2 + PHP 5.5.19)
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...
- 记录一次自己对nginx+fastcgi(fpm)+mysql压力测试结果
nginx + fastcgi(fpm) 压力测试: CentOS release 5.9 16核12G内存 静态页面: 并发1000,压测200秒,测试结果: 系统最大负载5.47 成功响应: 25 ...
- yum install nginx
先安装nginx的yum源 http://nginx.org/en/linux_packages.html#stable 找到链接,安装: rpm -ivh http://nginx.org/pack ...
- linux应用之nginx的安装及配置(centos)
Ubuntu/CentOS 系统上安装与配置Nginx 一.在线安装: Ubuntu:sudo apt-get install nginx CentOS: sudo yum install nginx ...
随机推荐
- 请用fontAwesome代替网页icon小图标(转)
1. 引言 网页小图标到处可见,如果一个网页都是干巴巴的文字和图片,而没有小图标,会显得非常简陋.下面的小图标,你是不是会经常用到? 你可能说——“我们用的都是彩色的,不是黑白的”——别着急,下面会讲 ...
- PythonNote02_HTML标签
<!DOCTYPE> <html> <head> <meta charset = "utf-8" /> <meta name= ...
- ElasticSearch 入门(转)
最大的特点: 1. 数据库的 database, 就是 index 2. 数据库的 table, 就是 tag 3. 不要使用browser, 使用curl来进行客户端操作. 否则会出现 jav ...
- Paxos在大型系统中的应用场景
https://timyang.net/distributed/paxos-scenarios/ 在分布式算法领域,有位非常重要的短发叫Paxos,它的重要性有多高呢?Google的Chubby[1] ...
- 机器学习初探(手写数字识别)HOG图片
这里我们讲一下使用HOG的方法进行手写数字识别: 首先把 代码分享出来: hog1.m function B = hog1(A) %A是28*28的 B=[]; [x,y] = size(A); %外 ...
- Socket编程--TCP粘包问题
TCP是个流协议,它存在粘包问题 产生粘包的原因是: TCP所传输的报文段有MSS的限制,如果套接字缓冲区的大小大于MSS,也会导致消息的分割发送. 由于链路层最大发送单元MTU,在IP层会进行数据的 ...
- Spring JDBCTemplate配置使用
一.开发环境 Windows 10 IntelliJ IDEA 2016.1 旗舰版 JDK1.8 二.项目和数据库结构 项目结构: 数据库(MySQL 5.5.39): /* Navicat MyS ...
- txt中把换行替换为空格
把合适改为html后打开,换行都没了,然后复制到另一个txt即可
- Microsoft Visio绘图
2000年微软公司收购同名公司后,Visio成为微软公司的产品.Microsoft Visio是Windows 操作系统下运行的流程图软件,它现在是Microsoft Office软件的一个部分.Vi ...
- boostrap selectpicker 用法
1..html中先引用 <link href="{{ url_for('static', filename='css/bootstrap-select.css') }}" r ...