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 ...
随机推荐
- 利用JavaScriptCore实现简单的功能(阶乘)
#import "RootViewController.h" #import <JavaScriptCore/JavaScriptCore.h> @interface ...
- 628D Magic Numbers
传送门 题目大意 定义n-magic为从左往右,偶数位置均为n,奇数位置不为n的一类数.求出[a,b]内所有可被m整除的d-magic个数. 分析 显然是数位dp,我们用dp[i][j][k]表示考虑 ...
- 树莓派研究笔记(3)-- 安装VNC
小屏幕太小了,眼睛快看瞎了,必须安装VNC 才行啊. 更新—2018-02-04 最新版本的系统中自带了VNC了,只需要在 菜单 Preferences -> Raspberry Pi Conf ...
- 浅谈android代码保护技术_ 加固
浅谈android代码保护技术_加固 导语 我们知道Android中的反编译工作越来越让人操作熟练,我们辛苦的开发出一个apk,结果被人反编译了,那心情真心不舒服.虽然我们混淆,做到native层,但 ...
- nstallShield制作打包程序详解(图)
InstallShield产品,是安装工具领域事实上的标准.InstallShield 软件是软件安装.配置软件包和升级解决方案领域内公认的标准.InstallShield已经成为安全安装软件的标准解 ...
- Data Base mysql备份与恢复
mysql 备份与恢复 为什么要备份: 由于系统使用到了MySQL 数 据库,所以每天的工作,就设计到了MySQL数据库的备份问题.但如果每天手工来做MySQL数据库的定时备份,工作量不说,时间还不 ...
- boostrap selectpicker 用法
1..html中先引用 <link href="{{ url_for('static', filename='css/bootstrap-select.css') }}" r ...
- 编译原理-First集和Follow集
刚学first集和follow集的时候,如果上课老师没有讲明白或者自己没听明白,自己看的时候还真是有点难理解,不过结合着具体的题目可以理解的更快. 先看一下两种集合的求法: First集合的求法: ...
- 多层mvc,thikphp进阶
程序员,是一种生活态度. 我尽忠恪守,我努力进取,热衷于解决问题,希望得到同样的回报. 我遇到问题,将所有的力量用在解决问题,而不是抱怨,推卸责任上. ------------------------ ...
- wget使用技巧
以下内容为转载: wget 是一个命令行的下载工具.对于我们这些 Linux 用户来说,几乎每天都在使用它.下面为大家介绍几个有用的 wget 小技巧,可以让你更加高效而灵活的使用 wget. $ w ...