• 安装nginx

apt-get install nginx
  • 配置nginx

位置: /etc/nginx/nginx.conf  ,其中包含了

include /etc/nginx/conf.d/*.conf;  

include /etc/nginx/sites-enabled/*;

在这两个配置中的文件也是生效的。

错误日志  error_log /var/log/nginx/error.log; ,这个非常实用,在后面的配置完成重启后,可以通过此日志来快速排错。

这里,我们把配置文件放在  /etc/nginx/sites-enabled/default; 中。

index index.php index.html index.htm;

...

location ~\.php$ {
try_files $uri = ;
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
include fastcgi_params;
}

保存文件,使配置文件生效

/etc/init.d/nginx reload

nginx相关命令

service nginx start
service nginx stop
service nginx restart

在  /usr/share/nginx/html 下新建index.php

<?php
phpinfo();
  • 安装PHP

sudo apt-get install php5-fpm
sudo apt-get install php5-gd # Popular image manipulation library; used extensively by Wordpress and it's plugins.
sudo apt-get install php5-cli # Makes the php5 command available to the terminal for php5 scripting
sudo apt-get install php5-curl # Allows curl (file downloading tool) to be called from PHP5
sudo apt-get install php5-mcrypt # Provides encryption algorithms to PHP scripts
sudo apt-get install php5-mysql # Allows PHP5 scripts to talk to a MySQL Database
sudo apt-get install php5-readline # Allows PHP5 scripts to use the readline function
  • 配置php监听端口

位置: /etc/php5/fpm/pool.d/www.conf

把 listen = /var/run/php5-fpm.sock 改为:
listen = 127.0.0.1:9000

查看php运行进程

ps -waux | grep php5

php启动相关命令

service php5-fpm stop
service php5-fpm start
service php5-fpm restart
service php5-fpm status

重启php进程,访问查看效果

curl http://localhost

若是不生效,可通过查看/var/log/nginx/error.log 日志来定位

参考文档:https://www.cnblogs.com/Bonker/p/4252588.html

ubuntu下nginx+PHP-FPM安装配置的更多相关文章

  1. Linux系统下Nginx+PHP 环境安装配置

    一.编译安装Nginx 官网:http://wiki.nginx.org/Install 下载:http://nginx.org/en/download.html # tar -zvxf nginx- ...

  2. Linux_CentOS 7下Nginx服务器的安装配置

    1.安装 1.1 配置epel yum 源 wget http://dl.Fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm ...

  3. ubuntu下php xdebug的安装(配置)

    首先Xdebug要和php版本对应,具体查看官网    https://xdebug.org/ xdebug-2.1.0PHP Version 5.3.10linux下解压xdebug包.1.进入xd ...

  4. Linux下Nginx+PHP 简单安装配置

    测试环境 Linux 2.6.18nginx-1.0.4 http://www.nginx.org/php-5.3.6 http://www.php.net/ 一,安装Nginxwget http:/ ...

  5. ubuntu下java和tomcat安装配置

    oracle下载jdk-7u51-linux-i586.tar.gz sudo cp Downloads/jdk-7u51-linux-i586.tar.gz /usr/local/java //拷贝 ...

  6. Ubuntu 下 firebird 数据库的安装和配置

    Ubuntu 下 firebird 数据库的安装和配置 1.简介 本文主要是 Ubuntu 下 firebird 数据库的安装和目录迁移,同样适用于 Debian 系统:Ubuntu 20.0.4 f ...

  7. ubuntu下nginx+php5的部署

    ubuntu下nginx+php5环境的部署和centos系统下的部署稍有不同,废话不多说,以下为操作记录:1)nginx安装root@ubuntutest01-KVM:~# sudo apt-get ...

  8. Ubuntu下Nginx启动、停止等常用命令

    本文详细介绍Ubuntu下Nginx启动.停止等常用命令.在开发过程中,我们会经常的修改Nginx的配置文件,每次修改配置文件都可以先测试下本次修改的配置文件是否正确,可以利用以下命令: servic ...

  9. ubuntu下opencv2.4.9安装测试

    ubuntu下opencv2.4.9安装测试 whowhoha@outlook.com 一.依赖包安装 1.  build-essential 软件包 sudo apt-get install bui ...

  10. 在Ubuntu 12.04系统中安装配置OpenCV 2.4.3的方法

    在Ubuntu 12.04系统中安装配置OpenCV 2.4.3的方法   对于,在Linux系统下做图像识别,不像在windows下面我们可以利用Matlab中的图像工具箱来实现,我们必须借助Ope ...

随机推荐

  1. Oracle:热备时,突然断电情况处理

    我们在热备时,如果此时突然停电,再次启动时会发生什么情况呢? SQL> alter tablespace users begin backup; Tablespace altered. SQL& ...

  2. hiho Mission Impossible 6(模拟 未提交验证。。)

    题意:模拟文本操作 思路:模拟 #include<iostream> #include<stdio.h> #include<string.h> using name ...

  3. 创建app前的环境配置/AppIcon/启动图片

    1.真机调试http://blog.csdn.net/tht2009/article/details/48580569 2.创建app前的环境配置

  4. 「NOIP2000」「Codevs1042」 进制转换

    题目描述 Description 我们可以用这样的方式来表示一个十进制数: 将每个阿拉伯数字乘以一个以该数字所处位置的(值减1)为指数,以10为底数的幂之和的形式.例如:123可表示为 1*102+2 ...

  5. caffe 入门实例2 如何写一个模型

    占坑,记录如何写一个基于lenet5的模型,并进行测试.

  6. k8s-helm-二十四

    一.介绍 Helm是Kubernetes的一个包管理工具,用来简化Kubernetes应用的部署和管理.可以把Helm比作CentOS的yum工具. yum不光要解决包之间的依赖关系,还要提供具体的程 ...

  7. 斯坦福CS231n—深度学习与计算机视觉----学习笔记 课时7

    课时7 线性分类器损失函数与最优化(下) 我们为什么要最大化对数概率而非直接最大化概率? 你在做逻辑斯蒂回归时,如果你只是想要最大化概率,那你使用log是无意义的.因为log函数是单调函数,最大化概率 ...

  8. cardboard sdk for unity 系统分析 - 属性行为分析CardBoard类

    一.CardBoard类是个单例类,全局只有一个CardBoard对像且在需要时才生成: CardBoard中主要使用了BaseVRDevice device这个对像,而这个对像也是单例类BaseVR ...

  9. POJ2369【循环节】

    题意: 给一个序列,他需要几步就能变成原来的序列. 思路: 那么就是找一下各个循环节(用dfs随便搞了-),求一下最小公倍数就好了. 贴一发挫code- //#include <bits/std ...

  10. Codeforces702A - Maximum Increase【尺取】

    题意: 求一个连续的最长子序列长度: 思路: 没看仔细还wa1了-以为LIS- 然后写了尺取吧...= =太不仔细了.不过收获是LIS特么写挫了然后看了学长的blog<-点我- 题目的挫code ...