Centos 6.3设置php、mysql、nginx开机自启动
vim /etc/init.d/nginx
输入如下nginx脚本:
#!/bin/bash # # chkconfig: - 85 15 # description: Nginx is a World Wide Web server. # processname: nginx nginx=/app/nginx/sbin/nginx #这里/app/是nginx安装路径 conf=/app/nginx/conf/nginx.conf case $1 in start) echo -n "Starting Nginx" $nginx -c $conf echo " done" ;; stop) echo -n "Stopping Nginx" killall -9 nginx echo " done" ;; test) $nginx -t -c $conf ;; reload) echo -n "Reloading Nginx" ps auxww | grep nginx | grep master | awk '{print $2}' | xargs kill -HUP echo " done" ;; restart) $0 stop $0 start ;; show) ps -aux|grep nginx ;; *) echo -n "Usage: $0 {start|restart|reload|stop|test|show}" ;; esac
保存,再用命令
chmod +x /etc/init.d/nginx
chkconfig nginx on
开启nginx自动启动。
cp -f sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm #从php压缩包里复制init.d.php-fpm 到/etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm chkconfig php-fpm on cp -f support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld chkconfig mysqld on
本博客所有文章如无说明,则均为作者黄丁丁原创
转载请注明出处:http://www.cnblogs.com/huangdingding
浙公网安备 33010602011771号