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 ...
随机推荐
- interface 接口 和多态的含义
<?php //interface关键字用于定义接口 interface ICanEat{ //接口里面的方法不需要方法的实现 public function eat($food) ; } // ...
- 项目一:第十二天 1、常见权限控制方式 2、基于shiro提供url拦截方式验证权限 3、在realm中授权 5、总结验证权限方式(四种) 6、用户注销7、基于treegrid实现菜单展示
1 课程计划 1. 常见权限控制方式 2. 基于shiro提供url拦截方式验证权限 3. 在realm中授权 4. 基于shiro提供注解方式验证权限 5. 总结验证权限方式(四种) 6. 用户注销 ...
- hibernate 对象OID
它是hibernate用于区分两个对象是否是同一个对象的标识. 我们都知道,虚拟机内存区分两个对象看的是内存的地址是否一致.数据库区分两个对象,靠的是表的主键.hibernate负责把内存中的对象持久 ...
- AdapterPattern(23种设计模式之一)
设计模式六大原则(1):单一职责原则 设计模式六大原则(2):里氏替换原则 设计模式六大原则(3):依赖倒置原则 设计模式六大原则(4):接口隔离原则 设计模式六大原则(5):迪米特法则 设计模式六大 ...
- java中怎么把String转化为字符数组呢?
我想让用户输入一组字符串,然后将这个字符串的每一个赋给一个char.即,abcde char ch[]=new char[5]; ch[0]=a;ch[1]=b;..... 解决方案如下图所示: St ...
- Proxool Provider unable to load JAXP configurator file: proxoolconf.xml
Proxool Provider unable to load JAXP configurator file: proxoolconf.xml log4j:WARN No appenders coul ...
- 《Maven实战》笔记-6-maven测试
一.基于Maven的测试 1.maven-surefire-plugin插件 该插件的test目标会自动执行测试源码路径(默认src/test/java)下符合以下命名模式的测试类: 以Test开头或 ...
- Dreamweaver Flash Photoshop网页设计综合应用 (智云科技) [iso] 1.86G
全书共15章,主要包括网页制作基础.Dreamweaver CC网页制作.Photoshop CC网页图像设计.Flash CC网页动画设计以及综合案例实战5个部分.通过本书的学习,不仅能让读者学会三 ...
- access + vb + asp 遇到一些问题的总结
Data Base access + vb + asp 遇到一些问题的总结 1.asp中sql语句: select * from users whre name=’张三‘ and addTime=# ...
- 如何理解虚拟React的DOM(转)
目录: 1 前言 2 对前端应用状态管理思考 3 Virtual DOM 算法 4 算法实现 4.1 步骤一:用JS对象模拟DOM树 4.2 步骤二:比较两棵虚拟DOM树的差异 4.3 步骤三:把差异 ...