找回密码
 立即注册
查看: 8884|回复: 0

tomato、dd-wrt安装nginx+php

[复制链接]
发表于 2012-8-24 14:22:31 | 显示全部楼层 |阅读模式
DD-WRT下用的源是http://ipkg.nslu2-linux.org/feeds/optware/ddwrt/cross/stable/
1.ipkg install nginx php spawn-fcgi php-fcgi

2.修改nginx配置文件
vi /opt/etc/nginx/nginx.conf

修改以下内容
user  root

server {
    #端口
    listen  8081;
    #网站根目录
    root   /mnt/www;
    location / {
        #默认主页
        index  index.html index.htm index.php;
    }
    location ~.php$ {
        include        fastcgi_params;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    }


3.新建一个php测试文件
vi /mnt/www/index.php

输入以下内容
<?php phpinfo(); ?>
保存退出

4.增加一个nginx+php的启动脚本
vi /mnt/nginx.sh

输入以下内容
#!/bin/sh

killall nginx
killall php-fcgi
sleep 2
spawn-fcgi -a 127.0.0.1 -p 9000 -C 1 -f /opt/bin/php-fcgi
/opt/etc/init.d/S80nginx start

保存退出,增加执行权限
chmod +x /mnt/nginx.sh

启动nginx和php
/mnt/nginx.sh

现在打开 http://路由ip:8081 应该可以看到php相关信息了



PS.如果遇到php报No input file specified错误,更改/opt/etc/php.ini这个文件,查找
doc_root =
将=号后面的路径删除即可!
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|第一站论坛 ( 蜀ICP备06004864号-6 )

GMT+8, 2024-5-2 18:53 , Processed in 0.075974 second(s), 22 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表