nginx+php虚拟目录下支持php脚本

sudo apt-get install nginx php5-cli php5-cgi

sudo apt-get install lighttpd rcconf

sudo vim /etc/nginx/sites-available/default

location /myweb {

root /home/admin;

autoindex on;

index index.htm index.html index.php;

}

location ~ \.php$ {

root /var/www/nginx-default;

if ( $uri ~ ^/myweb/ ) {

root /home/ihefeadmin;

}

fastcgi_pass   127.0.0.1:9000;

fastcgi_index  index.php;

#fastcgi_param  SCRIPT_FILENAME  /var/www/nginx-default$fastcgi_script_name;

include fastcgi_params;

}

sudo vim /etc/nginx/fastcgi_params

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

spawn-fcgi -a 127.0.0.1 -p 9000 -C 10 -u www-data -f /usr/bin/php-cgi

cd /etc/init.d
cp nginx php-cgi
vim php-cgi
nginx –> php-cgi

DAEMON=/usr/bin/spawn-fcgi
DAEMON_OPTS=”-a 127.0.0.1 -p 9000 -C 10 -u www-data -f /usr/bin/php-cgi”

stop)
echo -n “Stopping $DESC: ”
pkill -9 php-cgi
echo “$NAME.”

发表评论

电子邮件地址不会被公开。 必填项已用*标注

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>