Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2651895
  • 博文数量: 416
  • 博客积分: 10220
  • 博客等级: 上将
  • 技术积分: 4193
  • 用 户 组: 普通用户
  • 注册时间: 2006-12-15 09:47
文章分类

全部博文(416)

文章存档

2022年(1)

2021年(1)

2020年(1)

2019年(5)

2018年(7)

2017年(6)

2016年(7)

2015年(11)

2014年(1)

2012年(5)

2011年(7)

2010年(35)

2009年(64)

2008年(48)

2007年(177)

2006年(40)

我的朋友

分类: PHP

2016-11-07 15:01:40

一,安装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;
          }
 
  2,保存文件,使配置生效 /etc/init.d/nginx reload
 
  3,启动nginx
    /etc/init.d/nginx start
 
  4,在 /usr/share/nginx/html下新建index.php
    
阅读(1374) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~