• 安装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. android 一个TextView设置多种颜色

    时候一个文本框为了强调内容需要显示不同颜色,用以下代码可以轻松实现 方法一:(适用于颜色变化多的情况)   //为文本框设置多种颜色 textView=(TextView)findViewById(R ...

  2. Oracle :修改数据库服务器字符集

    最近,有现场反应,程序显示乱码.感觉很奇怪,该系统已经卖出去无数了.肯定是现场数据库字符集有问题,经过查看, 现场环境: window系统,oracle10g. 我们要求的数据库字符集是AL32UTF ...

  3. HBase集群出现NotServingRegionException问题的排查及解决方法

    HBase集群在读写过程中,可能由于Region Split或Region Blance等导致Region的短暂下线,此时客户端与HBase集群进行RPC操作时会抛出NotServingRegionE ...

  4. liunx命令之【查看某个端口号的使用情况】

    第一:查看端口占用情况的命令:lsof -i:<端口号>

  5. 【转】Chrome调试鼠标悬停后出现的元素

    原文地址:https://blog.csdn.net/sparrowflying/article/details/80996550 调试小技巧:调试样式的时候,有一类元素是鼠标悬停在特定位置才会出现的 ...

  6. Bootstrap-CSS:辅助类

    ylbtech-Bootstrap-CSS:辅助类 1.返回顶部 1. Bootstrap 辅助类 本章将讨论 Bootstrap 中的一些可能会派上用场的辅助类. 文本 以下不同的类展示了不同的文本 ...

  7. linux下ping不通的解决方法

    转自:https://blog.csdn.net/weixin_33400820/article/details/80227702 今天在做练习的时候,发现如何都无法ping通外网,在经过各种网络求助 ...

  8. A - Two Substrings

    Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Description You ar ...

  9. 算法练习--LeetCode--29. Divide Two Integers

    Divide Two Integers Given two integers dividend and divisor, divide two integers without using multi ...

  10. 用C++调用C的库函数(转载)

    转自:http://linhs.blog.51cto.com/370259/140927 C++调用C的库函数时,如果头文件定义得不恰当,可能会出现明明某函数在obj文件中存在,但是却发生链接失败的情 ...