Linux 環境邊配置邊學(針對家裏電腦) 【五】

1. 建立Nginx 及 CGI 啓動腳本php

vi /website/bin/php-cgi.sh

內容以下mysql

#!/bin/sh

case "$1" in
    start)
                echo 'nginx starting...'
                /usr/local/nginx/sbin/nginx
                echo 'spawn-fcgi starting...'
				/usr/local/spawn/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www -g www -f /usr/local/php/bin/php-cgi -C 20
        ;;
    stop)
                echo 'nginx stopping...'
                killall nginx
                echo 'spawn-fcgi stopping...'
                killall php-cgi
        ;;
    restart)
                echo 'nginx stopping...'
                killall nginx
                echo 'spawn-fcgi stopping...'
                killall php-cgi



                echo 'nginx starting...'
                /usr/local/nginx/sbin/nginx
                echo 'spawn-fcgi starting...'
				/usr/local/spawn/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www -g www -f /usr/local/php/bin/php-cgi -C 20

        ;;
    *)
        echo "Use: {start|stop|restart}"
esac
exit

建立啓動腳本nginx

vi /website/bin/init.sh

內容以下web

#!/bin/sh

#memcached -l 127.0.0.1 -d -p 11211 -u www -m 1024
/website/bin/php-cgi.sh start
/data0/mysql/3306/mysql start

 對這兩個文件進行權限設置sql

chmod 744 /website/bin/init.sh
chmod 744 /website/bin/php-cgi.sh

 

 2. 配置自啓動:shell

修改 /etc/rc.local 文件memcached

vi /etc/rc.local

在末尾添加spa

/website/bin/init.sh
相關文章
相關標籤/搜索