Home > Operation and Maintenance > Nginx > How to start nginx script

How to start nginx script

藏色散人
Release: 2019-08-27 11:05:46
Original
4511 people have browsed it

How to start nginx script

nginx如何启动脚本?

./nginx start 启动nginx
Copy after login
./nginx stop 关闭nginx
Copy after login
./nginx restart 重启nginx
Copy after login
#!/bin/bash
NGINX=/usr/local/nginx/sbin/nginx
PID=/usr/local/nginx/logs/nginx.pid
start()
{
if [ -f $PID ] 
then
echo "nginx已经启动!"
else
$NGINX
echo "nginx启动成功!"
fi
}
stop()
{
if [ -f $PID ]
then
killall -s QUIT nginx
echo "nginx已经关闭!"
else
echo "nginx未启动!"
fi
}
restart()
{
if [ -f $PID ]
then
stop
fi
start
}
case $1 in
"start") start
;;
"stop") stop
;;
"restart") restart
;;
*) echo "请输入正确的操作参数start|stop|restart"
;;
esac
Copy after login

Nginx简介:

Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器,同时也提供了IMAP/POP3/SMTP服务。Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Rambler.ru站点(俄文:Рамблер)开发的,第一个公开版本0.1.0发布于2004年10月4日。

其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名。2011年6月1日,nginx 1.0.4发布。

Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,在BSD-like 协议下发行。其特点是占有内存少,并发能力强,事实上nginx的并发能力确实在同类型的网页服务器中表现较好,中国大陆使用nginx网站用户有:百度、京东、新浪、网易、腾讯、淘宝等。

更多Nginx相关技术文章,请访问Nginx使用教程栏目进行学习!

The above is the detailed content of How to start nginx script. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template