ubuntu14.04 +nginx+php5-fpm

前端之家收集整理的这篇文章主要介绍了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/*;
这两个配置,所以这里面的配置也是有效的。
错误日志error_log /var/log/Nginx/error.log;
  这里我们把配置写在/etc/Nginx/sites-available/default中
  修改 root /usr/share/Nginx/html; 这是网页的根目录,默认里面有一个index.html页面
index index.html index.htm修改成indexindex.PHPindex.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  改为

重新运行PHP进程

在浏览器中输入 localhost就可以看到了listen = 127.0.0.1:9000

猜你在找的Ubuntu相关文章