• 安装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. python startswith和endswith

    startswith判断文本是否以某个或某几个字符开始; endswith判断文本是否以某个或某几个字符结束; text = 'Happy National Day!' print text.star ...

  2. 【POJ 3468】 A Simple Problem with Integers

    [题目链接] 点击打开链接 [算法] 本题用线段树很容易写,但是,笔者为了练习树状数组,就用树状数组的方法做了一遍 我们不妨引入差分数组c, 则sum(n) = c[1] + (c[1] + c[2] ...

  3. CS231n 2016 通关 第一章-内容介绍

    第一节视频的主要内容: Fei-Fei Li 女神对Computer Vision的整体介绍.包括了发展历史中的重要事件,其中最为重要的是1959年测试猫视觉神经的实验. In 1959 Harvar ...

  4. Meet User Expectations---满足用户的期待

    Back to App Design Meet User Expectations OS X incorporates the latest technologies for creating gre ...

  5. React 从入门到进阶之路(八)

    之前的文章我们介绍了 React中的组件.父子组件.React props父组件给子组件传值.子组件给父组件传值.父组件中通过refs获取子组件属性和方法.接下来我们将介绍 React propTyp ...

  6. 洛谷 P2578 [ZJOI2005]九数码游戏【bfs+康托展开】

    只有9!=362880个状态,用康托展开hash一下直接bfs即可 #include<iostream> #include<cstdio> #include<cstrin ...

  7. 洛谷P1850 换教室(概率dp)

    传送门 我的floyd竟然写错了?今年NOIP怕不是要爆零了? 这就是一个概率dp 我们用$dp[i][j][k]$表示在第$i$个时间段,已经申请了$j$次,$k$表示本次换或不换,然后直接暴力转移 ...

  8. scrapy 连接错误

    twisted.python.failure.failure twisted.internet.error.connectionlost: connection to the other side w ...

  9. the little schemer 笔记(1)

    第 1 章 玩具 这是原子atom吗?atom是的,因为atom是一个字母a开头的字符串. 这是原子atom吗?turkey是的,因为atom是字母开头的字符串. 这是原子atom吗?1492是的,因 ...

  10. 关于C_Cpp的一些小结

    ## 某些函数的使用 1. printf / sprintf / fprintf printf:把格式字符串输出到标准输出(可重定向) sprintf:把格式字符串输出到指定字符串中,参数比print ...