Running Tengine
- Start Nginx using either of the following methods:Method 1: Start Nginx using a script.
1/usr/local/tengine-nginx/sbin/nginx -c /usr/local/tengine-nginx/conf/nginx.conf
Method 2: Start Nginx as a service (recommended). Add Nginx to the Service list, and then start the service using a command.
- Edit the /etc/init.d/nginx file.
- Open /etc/init.d/nginx.
1 2
rm -rf /etc/init.d/nginx vim /etc/init.d/nginx
- Press i to enter the insert mode and add the following content to the file:
#!/bin/bash # chkconfig: 2345 10 90 # description: nginx case "$1" in 'start') /usr/local/tengine-nginx/sbin/nginx -c /usr/local/tengine-nginx/conf/nginx.conf echo "$0_start"; ;; 'stop') /usr/local/tengine-nginx/sbin/nginx -s quit echo "$0_stop"; ;; esac - Press Esc, type :wq!, and press Enter to save the file and exit.
- Open /etc/init.d/nginx.
- Modify the permission on the /etc/init.d/nginx file.
1 2
chmod 777 /etc/init.d/nginx ll /etc/init.d/nginx
- Add Nginx to the chkconfig management list.
1chkconfig --add /etc/init.d/nginx
- Enable Nginx to automatically start upon OS startup.
1chkconfig nginx on
- Start Nginx.
1service nginx start
- Edit the /etc/init.d/nginx file.
- Check the Tengine process.
1ps -ef | grep nginx

You can stop Nginx using one of the following methods. Stopping Nginx interrupts services. Exercise caution when performing this operation.
- Stop Nginx using a script.
1/usr/local/tengine-nginx/sbin/nginx -s quit
- Stop Nginx using a process.
1pkill nginx - Stop Nginx using the service.
1service nginx stop
- Stop Nginx using a script.
Parent topic: Running and Verifying Tengine