1、测试新的Nginx程序是否正确

[test@P-SH-Nginx-01 nginx]$ ./sbin/nginx -t

nginx: the configuration file /usr/local/openresty/nginx/conf/nginx.conf syntax is ok

nginx: [emerg] open() "/usr/local/openresty/nginx/logs/access.log" failed (13: Permission denied)

nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test failed

2、启动Nginx

test@P-SH-Nginx-01 openresty]$ sudo ./nginx/sbin/nginx -c conf/nginx.conf

/usr/local/nginx/sbin/nginx -t

nginx: theconfiguration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx:configuration file /usr/local/nginx/conf/nginx.conf test issuccessful

3、查看Nginx是否已经启动起来

[test@P-SH-Nginx-01 openresty]$ ps -ef |grep nginx

root      46505      1  0 01:41 ?        00:00:00 nginx: master process ./nginx/sbin/nginx -c conf/nginx.conf

nobody    46506  46505  0 01:41 ?        00:00:00 nginx: worker process

test      46528  28392  0 01:42 pts/0    00:00:00 grep --color=auto nginx

4、查看Ngixn版本及其编译参数,注意参数是大写字母V

[test@P-SH-Nginx-01 openresty]$  ./nginx/sbin/nginx -V

nginx version: openresty/1.11.2.5

built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)

built with OpenSSL 1.0.2k-fips  26 Jan 2017

TLS SNI support enabled

configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt=-O2 --add-module=../ngx_devel_kit-0.3.0 --add-module=../echo-nginx-module-0.61 --add-module=../xss-nginx-module-0.05 --add-module=../ngx_coolkit-0.2rc3 --add-module=../set-misc-nginx-module-0.31 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.06 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.10 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.32 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.18 --add-module=../redis2-nginx-module-0.14 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.14 --add-module=../rds-csv-nginx-module-0.07 --with-ld-opt=-Wl,-rpath,/usr/local/openresty/luajit/lib --with-http_stub_status_module --with-http_ssl_module

5、验证Nginx是否正常运行

[test@P-SH-Nginx-01 openresty]$ curl -I http://127.0.0.1

HTTP/1.1 200 OK

Server: openresty/1.11.2.5

Date: Fri, 15 Dec 2017 01:58:18 GMT

Content-Type: text/html

Content-Length: 562

Last-Modified: Thu, 26 Oct 2017 04:12:11 GMT

Connection: keep-alive

ETag: "59f1609b-232"

Accept-Ranges: bytes

6、重启Nginx

[test@P-SH-Nginx-01 openresty]$ sudo ./nginx/sbin/nginx -s reload

Nginx常用命令之启动与重启的更多相关文章

  1. Nginx常用命令(启动/重启/停止/测试配置文件/重新加载配置文件)

    Nginx 安装后只有一个程序文件,本身并不提供各种管理程序,它是使用参数和系统信号机制对 Nginx 进程本身进行控制的. Nginx 的参数包括有如下几个: 使用: /usr/local/ngin ...

  2. Nginx和PHP-FPM的启动、重启、停止脚本分享

    这篇文章主要介绍了Nginx和PHP-FPM的启动.重启.停止脚本分享,脚本中包含start.stop.reload.restart等常用的管理方法,并可以加入系统服务然后使用servicem命令管理 ...

  3. Nginx系列一:正向代理和反向代理、Nginx工作原理、Nginx常用命令和升级、搭建Nginx负载均衡

    转自https://www.cnblogs.com/leeSmall/p/9351343.html 仅供个人学习 一.什么是正向代理.什么是反向代理 1. 正向代理,意思是一个位于客户端和原始服务器( ...

  4. nginx常用命令及简单配置

    nginx常用命令 nginx -c /usr/local/nginx/conf/nginx.conf 启动nginx(windows下start nginx); nginx -s quit 停止ng ...

  5. nginx常用命令汇总

    nginx基础命令: sudo nginx // 开启nginx服务器 sudo nginx -s reload // 重启nginx服务器 sudo nginx -s stop // 关闭nginx ...

  6. 【Linux】nginx常用命令

    相关内容链接 Centos之安装Nginx及注意事项 [nginx]详细配置说明 nginx常用命令 [重新加载配置]sudo nginx -s reload [打开nginx配置]sudo vim ...

  7. 记录Nginx常用命令

    在此记录下Nginx服务器常用命令(CentOS7.2.Nginx1.14.2环境) 启动Nginx:./usr/sbin/nginx Nginx检查语法:nginx -tc /etc/nginx/n ...

  8. nginx常用命令参数

    命令行参数: 常用命令: -c filename:设置配置文件. -t :不运行,而仅仅测试配置文件.nginx 将检查配置文件的语法的正确性,并尝试打开配置文件中所引用到的文件. -s :传递一个信 ...

  9. Nginx常用命令,解决你日常运维的烦恼

    前面,跟大家简单地介绍了负载均衡和Nginx的一些基础配置(Nginx负载均衡配置实例),接下来,跟大家介绍一下Nginx的常用命令,便于日常的运维. 查看原文 停止Nginx的方法 通过之前的学习, ...

随机推荐

  1. 下载并配置pycharm

    1.下载(推荐下载社区版) https://www.jetbrains.com/pycharm/download/#section=windows 2.配置代码编写前注释 得到这种效果: 3.设置字体 ...

  2. 出现bash: ifconfig:command not found的解决办法,即安装ifconfig命令(亲测有效)

    初装centos 7时,运行config报 command not found 错误, ifconfig命令是设置或显示网络接口的程序,可以显示出我们机器的网卡信息,可是有些时候最小化安装CentOS ...

  3. 520,用Python定制你的《本草纲目女孩》

    摘要:让我们来用Python定制出心仪的"本草纲目女孩",敲出魔性的代码舞蹈,520,准备好心仪女孩的舞蹈视频,把这份别出心裁的礼物给TA 本文分享自华为云社区<[云驻共创] ...

  4. Fail2ban 配置详解 过滤器配置

    Fail2ban自带了很多相关服务日志的过滤器. ### # 包含配置 ### [INCLUDES] before = common.conf # 还包含其他文件中的配置,在加载本配置文件中配置之前先 ...

  5. Dubbo3 源码系列 -- 环境准备

    Dubbo3 源码系列 -- 环境准备 前言 工作中一直使用Dubbo项目,借着这次机会通过源码的方式来学习下Dubbo的源码内容.目前市面上很多都是的Dubbo2系列的教程:就连目前的Dubbo的官 ...

  6. Java概论——JavaSE基础

    Java概论 Java特性和优势 简单性 面向对象 可移植性 高性能:即时编译 分布式:可处理TCP/IP协议的一些东西 动态性:通过反射机制使其具有动态性 多线程:良好的交互性和实时性 安全性:防病 ...

  7. 计算机环境变量的配置,以java为例以及eclipse简要设置

    安装JDK时可以不安装公共jre.因为好多软件和浏览器已经默认自带的jre了,或者自动调用系统的了. 在java 中需要设置三个环境变量(1.5之后不需要再设置CLASSPATH了,但需要的话可以设置 ...

  8. C# 将HTML转为XML

    本文以C#及VB.NET后端程序代码示例展示如何将HTML转为XML文件.转换时,调用Word API -Free Spire.Doc for .NET 提供的文档加载方法及文档保存的方法来实现.转换 ...

  9. TypeScript 泛型(generic) 入门介绍

    TypeScript 泛型函数 下面来创建第一个使用泛型的例子:identity函数.这个函数会返回任何传入它的值.你可以把这个函数当成是echo命令.不用泛型的话,这个函数可能是下面这样: func ...

  10. tmux(Terminal MultipleXer)命令使用

    作用:命令行多窗口显示:命令行程序与本机脱离 1 安装tmux (1)redhat.centos系统 yum install tmux (2)ubuntu系统 apt-get install tmux ...