zoukankan      html  css  js  c++  java
  • ubuntu14 + nginx + php

    ubuntu14

    1.安装nginx
    sudo apt-get install nginx

    安装之后的文件结构大致为:
    * 所有的配置文件都在/etc/nginx下,并且每个虚拟主机已经安排在了/etc/nginx/sites-available下
    * 日志放在了/var/log/nginx下
    * 并已经在/etc/init.d/下创建了启动脚本nginx
    * 默认的虚拟主机的目录设置在了/usr/share/nginx/html

    启动nginx
    sudo service nginx start


    2.安装php
    sudo apt-get install php5 php5-cgi

    3.安装fastcgi
    sudo apt-get install spawn-fcgi

    4.配置nginx
    修改nginx的配置文件:/etc/nginx/sites-available/default
     
    修改index的一行为:
    index index.php index.html index.htm;

    去掉下面部分的注释用于支持php脚本:
    location ~ /.php$ {
      fastcgi_split_path_info ^(.+.php)(/.+)$;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    重启nginx
    sudo service nginx restart

    5.用spawn-fcgi启动php5-cgi
    spawn-fcgi -a 127.0.0.1 -p 9000 -C 10 -u www-data -f /usr/bin/php5-cgi

    6.测试
    在/usr/share/nginx/html/下新建一个index.php文件
    <?php echo phpinfo(); ?>
    访问 http://localhost 即可测试成功

  • 相关阅读:
    jsp作业第二次
    软件测试课堂练习
    第七次作业
    第六次作业
    第五次作业
    第四次作业
    第七周作业
    jsp第六周作业
    jsp第四周作业
    jsp第二次作业
  • 原文地址:https://www.cnblogs.com/freebird92/p/5002102.html
Copyright © 2011-2022 走看看