首页 技术 正文
技术 2022年11月6日
0 收藏 695 点赞 589 浏览 1546 个字

启动
 启动代码格式:nginx安装目录地址 -c nginx配置文件地址

例如:

[root@LinuxServer sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

停止
 nginx的停止有三种方式:

从容停止
  1、查看进程号

[root@LinuxServer ~]# ps -ef|grep nginx

  2、杀死进程

[root@LinuxServer ~]# kill -QUIT 2072

快速停止
1、查看进程号

[root@LinuxServer ~]# ps -ef|grep nginx

2、杀死进程

[root@LinuxServer ~]# kill -TERM 2132
或 [root@LinuxServer ~]# kill -INT 2132

强制停止

[root@LinuxServer ~]# pkill -9 nginx

重启
1、验证nginx配置文件是否正确
方法一:进入nginx安装目录sbin下,输入命令./nginx -t
看到如下显示nginx.conf syntax is ok

nginx.conf test is successful

说明配置文件正确!

方法二:在启动命令-c前加-t

2、重启Nginx服务
 方法一:进入nginx可执行目录sbin下,输入命令./nginx -s reload 即可

方法二:查找当前nginx进程号,然后输入命令:kill -HUP 进程号 实现重启nginx服务

————————————————

pgrep /pkill

EXAMPLES
Example 1: Find the process ID of the named daemon:

$ pgrep -u root named

Example 2: Make syslog reread its configuration file:

$ pkill -HUP syslogd

Example 3: Give detailed information on all xterm processes:

$ ps -fp $(pgrep -d, -x xterm)

Example 4: Make all netscape processes run nicer:

$ renice +4 $(pgrep netscape)

验证配置是否正确: nginx -t

查看Nginx的版本号:nginx -V

启动Nginx:start nginx

快速停止或关闭Nginx:nginx -s stop

正常停止或关闭Nginx:nginx -s quit

配置文件修改重装载命令:nginx -s reload

1、错误情况:

nginx: [error] CreateFile() “E:\nginx\nginx-1.9.3/logs/nginx.pid” failed

nginx: [error] Open() “E:\nginx\nginx-1.9.3/logs/nginx.pid” failed

使用命令创建/logs/nginx.pid文件: nginx -c conf/nginx.conf

相关文档说明:

http://www.cnblogs.com/wangkongming/p/4004416.html

http://www.cnblogs.com/xiaogangqq123/archive/2011/03/02/1969006.html

 

2、配置多个80端口 server:

相关文档说明:

http://os.51cto.com/art/201404/437182.htm

3、不同端口为本地nginx服务器配置多个站点:

相关文档说明:

http://blog.csdn.net/yongzhang52545/article/details/51282914

http://www.2cto.com/os/201411/355976.html

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,088
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,564
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,412
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,185
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,822
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,905