标签归档:nginx

nginx + php for mac 开机自动运行

sudo launchctl load -w /opt/local/etc/php5/php.plist

sudo vim /Library/LaunchDaemons/com.xxx.yyy.plist

<?xml version=’1.0′ encoding=’UTF-8’?>
<!DOCTYPE plist PUBLIC “-//Apple Computer//DTD PLIST 1.0//EN”
“http://www.apple.com/DTDs/PropertyList-1.0.dtd” >
<plist version=’1.0′>
<dict>
<key>Label</key><string>com.xxx.yyy</string>
<key>ProgramArguments</key>
<array>
<string>/opt/local/bin/php-cgi</string>
<string>-q</string>
<string>-b</string>
<string>127.0.0.1:900</string>
</array>
<key>Debug</key><false/>
<key>Disabled</key><true/>
<key>OnDemand</key><false/>
</dict>
</plist>

sudo launchctl load -w /Library/LaunchDaemons/com.xxx.yyy.plist

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.”

ubuntu下安装nginx和php

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

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

index index.php index.html index.htm;

location ~ \.php$ {

fastcgi_pass   127.0.0.1:9000;

fastcgi_index  index.php;

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

include /etc/nginx/fastcgi_params;

}

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