首页 > 其他 > 详细

第五篇 Nginx的简单配置

时间:2015-12-29 22:39:19      阅读:213      评论:0      收藏:0      [点我收藏+]

先安装:

sudo apt-get install nginx php5-fpm

我是在新安装的Ubuntu13上测试通过的,真的只安装这两个东西就够了。

 

然后编辑配置文件。

sudo gedit /etc/nginx/site-available/default

找到location ~ \.php$的地方,5行取消注释,变成这样:

 

[plain] view plaincopy技术分享技术分享
 
  1. location ~ \.php$ {  
  2. #   fastcgi_split_path_info ^(.+\.php)(/.+)$;  
  3. #   # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini  
  4. #  
  5. #   # With php5-cgi alone:  
  6. #   fastcgi_pass 127.0.0.1:9000;  
  7. #   # With php5-fpm:  
  8.     fastcgi_pass unix:/var/run/php5-fpm.sock;  
  9.     fastcgi_index index.php;  
  10.     include fastcgi_params;  
  11. }  

这就成了!

 

启动nginx:

sudo service nginx start

扩展:

1. default文件中,找到
index index.html index.htm;

这行,加入成

index index.html index.htm index.php;

这就可以用php文件做默认主页

 

第五篇 Nginx的简单配置

原文:http://www.cnblogs.com/zhouqingda/p/5087191.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!