ubuntu14.04 +nginx+php5-fpm

简介: 一,安装Nginx   apt-get install nginx   1,配置nginx     nginx所有的配置在 /etc/nginx/nginx.conf中     nginx.conf配置里面包括了       include /etc/nginx/conf.d/*.conf;            include /etc/nginx/sites-enabled/*;         这两个配置,所以这里面的配置也是有效的。

一,安装Nginx

  apt-get install nginx

  1,配置nginx

    nginx所有的配置在 /etc/nginx/nginx.conf中

    nginx.conf配置里面包括了

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

           include /etc/nginx/sites-enabled/*;
        这两个配置,所以这里面的配置也是有效的。
       错误日志 error_log /var/log/nginx/error.log;
 
  这里我们把配置写在 /etc/nginx/sites-available/default中
  修改  root /usr/share/nginx/html;   这是网页的根目录,默认里面有一个index.html页面
     index  index.html index.htm修改成index index.php index.html index.htm;
     增加  
       
  location ~ \.php$ {
                  try_files $uri =404;
                  fastcgi_pass 127.0.0.1:9000;
                  fastcgi_index index.php;
                  include fastcgi_params;
          }
 
  2,保存文件,使配置生效 /etc/init.d/nginx reload
 
  3,启动nginx
    /etc/init.d/nginx start
 
  4,在 /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

查看php5运行进程
ps -waux | grep php5

打开关闭php5进程

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

配置php5监听端口 /etc/php5/fpm/pool.d/www.conf

listen = /var/run/php5-fpm.sock  改为
AI 代码解读
listen = 127.0.0.1:9000

重新运行php进程

在浏览器中输入 localhost就可以看到了
AI 代码解读
作者:Bonker
出处:http://www.cnblogs.com/Bonker
QQ:519841366
       
本页版权归作者和博客园所有,欢迎转载,但未经作者同意必须保留此段声明, 且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利
目录
打赏
0
0
0
0
5
分享
相关文章
今日小结通过aliyun的本地容器镜像部署我的nginx和php环境
简介: 本教程介绍如何基于 Dragonwell 的 Ubuntu 镜像创建一个运行 Nginx 的 Docker 容器。首先从阿里云容器镜像服务拉取基础镜像,然后编写 Dockerfile 确保 Nginx 作为主进程运行,并暴露 80 端口。最后,在包含 Dockerfile 的目录下构建自定义镜像并启动容器,确保 Nginx 在前台运行,避免容器启动后立即退出。通过 `docker build` 和 `docker run` 命令完成整个流程。
107 24
今日小结通过aliyun的本地容器镜像部署我的nginx和php环境
当你的nginx服务器和php服务器不在一起的时候,这个nginx 的root目录问题
两个服务器的网站代码目录需要对齐,docker容器里面也是一样
如何在Ubuntu中切换多个PHP版本
通过上述步骤,您不仅能够高效地在Ubuntu系统中安装和切换PHP版本,还能根据项目需求灵活配置,大大提升开发效率与灵活性。更多关于服务器配置与优化的信息,获取全面的技术支持与解决方案。
157 1
Tengine、Nginx安装PHP命令教程
要在阿里云Linux上安装PHP,请先更新YUM源并启用PHP 8.0仓库,然后安装PHP及相关扩展。通过`php -v`命令验证安装成功后,需修改Nginx配置文件以支持PHP,并重启服务。最后,创建`phpinfo.php`文件测试安装是否成功。对于CentOS系统,还需安装EPEL源和Remi仓库,其余步骤类似。完成上述操作后,可通过浏览器访问`http://IP地址/phpinfo.php`测试安装结果。
在Ubuntu上手动与自动启动Nginx的踩坑经历、以及重启服务
本文分享了作者在Ubuntu系统上手动和自动启动Nginx服务的踩坑经历,包括创建启动脚本、解决依赖问题、配置服务自动启动以及通过命令行管理Nginx服务的方法。
526 0
在Ubuntu上手动与自动启动Nginx的踩坑经历、以及重启服务
Linux搭建tengine2.0<Nginx>+php7环境
本文介绍了在Linux系统上搭建Tengine 2.0(一个Nginx的增强版本)和PHP 7环境的详细步骤,包括创建安装目录、下载源码包及依赖库、编译安装Nginx、配置Nginx、安装PHP及其依赖、设置PHP-FPM、配置环境变量、安装Git和Composer,以及服务管理和日志查看等。
128 0
在Ubuntu 16.04上使用Nginx安装和保护phpMyAdmin的方法
在Ubuntu 16.04上使用Nginx安装和保护phpMyAdmin的方法
65 0
如何在 Ubuntu 14.04 服务器上使用 Nginx 安装和保护 phpMyAdmin
如何在 Ubuntu 14.04 服务器上使用 Nginx 安装和保护 phpMyAdmin
43 0
在Ubuntu上离线安装Nginx的踩坑经历
本文记录了作者在Ubuntu系统上离线安装Nginx的详细过程,包括下载、配置、解决依赖问题、编译和安装步骤,以及在安装过程中遇到的PCRE库依赖问题和解决方案。
1431 0