Nginx start stop php5.3.18 php-fpm start close configure to start the service

Source: Internet
Author: User
Nginx start stop php5.3.18 php-fpm start close configure to service start from php5.3.3 source code contains php-fpm, no need to fix it, just unlock the source code and directly configure, for php-fpm compilation parameters,-enable-fpm-with-fpm-user = www-with-f nginx start stop php 5.3.18 php-fpm start close configure to service start

Starting from php5.3.3, the source code contains php-fpm. you don't need to fix it any more. you just need to solve the source code and directly configure it,
The compiling parameters for php-fpm include-enable-fpm-with-fpm-user = www-with-fpm-group = www-with-libevent-dir = libevent.

This php-fpm does not support commands such as/usr/local/php/sbin/php-fpm (start | stop | reload) with the php-fpm patch. signal control is required:

The master process can understand the following signals:

SIGINT, SIGTERM terminated immediately
SIGQUIT ends smoothly
SIGUSR1 re-open the log file
SIGUSR2 smoothly reloads all worker processes and reloads configuration and binary modules.

Example:
Disable php-fpm:
Kill-SIGINT 'cat/usr/local/php/var/run/php-fpm.pid'
Php-fpm restart:
Kill-SIGUSR2 'cat/usr/local/php/var/run/php-fpm.pid'

Second, the configuration file is no longer in xml format and changed to INI, but the configuration parameters are almost the same as before. you can refer to the xml format configuration.


------ In php 5.3.6, php-fpm is configured as a service startup ------

Cp-f/tools/php-5.3.6/sapi/fpm/init. d. php-fpm/etc/init. d/php-fpm
Php-fpm startup:
# Vim/usr/local/webserver/php/etc/php-fpm.conf
The php-fpm.pid directory must be:/usr/local/webserver/php/var/run/php-fpm.pid

Chmod 755/etc/init. d/php-fpm
/Etc/init. d/php-fpm start
/Sbin/chkconfig -- add php-fpm (add to the startup service list)
/Sbin/chkconfig php-fpm on

Start, stop, and restart php-fpm:
/Etc/init. d/php-fpm start
/Etc/init. d/php-fpm stop

/Etc/init. d/php-fpm reload

The startup effect is as follows:
Hai_ISD_7_9_Cent56_64:/usr/local/webserver/php/etc # service php-fpm start
Starting php-fpm done
Hai_ISD_7_9_Cent56_64:/usr/local/webserver/php/etc # service php-fpm stop
Gracefully shutting down php-fpm. done
Hai_ISD_7_9_Cent56_64:/usr/local/webserver/php/etc # service php-fpm start
Starting php-fpm done
Hai_ISD_7_9_Cent56_64:/usr/local/webserver/php/etc # service php-fpm reload
Reload service php-fpm done

 

 

Absolute paths are recommended for nginx

1. start nginx (the nginx. conf file is basically located in the conf directory in the nginx main directory)

Nginx-c nginx. conf

2. stop nginx (the nginx. pid file is basically located in the logs directory in the nginx main directory)

Ps-ef | grep nginx: several nginx processes can be found. The master process is marked as the master process, and the other processes are subprocesses. stopping nginx is mainly to control the signal of the master process.

1) stop with ease

Kill-QUIT 'cat nginx. Pi'

2). stop quickly

Kill-TERM 'cat nginx. Pi'

Or

Kill-INT 'cat nginx. Pi'

3) force stop

Kill-9 'cat nginx. Pi'


3. smooth restart of nginx

First, verify that the new configuration file is correct: nginc-t-c nginx. conf. after the configuration file is successful, send the HUP signal to the main process: kill-HUP 'cat nginx. pid'


4. smooth nginx upgrade

1) back up the old executable file and use the new version to replace the old version.

2) the master process PID of the old version of kill-USR2 is smoothly upgraded. the new and old versions coexist.

3) the master process PID of the old version of kill-WINCH gradually closes the worker process of the old master process

4) when all the worker processes generated by the old master process are closed, you can decide whether to use the new version or the old version. (you need to use the kill command to kill the new or old master process)


#! /Bin/sh

BASE_DIR = '/usr/local /'

$ {BASE_DIR} nginx/sbin/nginx-t-c $ {BASE_DIR} nginx/conf/nginx. conf >&$ {BASE_DIR} nginx/logs/nginx. start

Info = 'cat $ {BASE_DIR} nginx/logs/nginx. start'

If ['echo $ info | grep-c "syntax is OK" '-eq 1]; then

If ['ps aux | grep "nginx" | grep-c "master" '= 1]; then

Kill-HUP 'cat $ {BASE_DIR} nginx/logs/nginx. pid'

Echo "OK"

Else

Killall-9 nginx

Sleep 1

$ {BASE_DIR} nginx/sbin/nginx

Fi

Else

Echo "######### error :########"

Cat $ {BASE_DIR} nginx/logs/nginx. start

Fi

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.