tags:

  • centOS
  • linux
  • nginx

    categories:
  • 服务器

找到nginx

首先,如果你忘记了你的nginx的安装目录,不妨使用以下命令,找到你的nginx:

find / -name nginx

这个时候,不出意外的话,你的界面将会出现一堆nginx路径,但是一般可执行的文件是在/sbin/或者/bin/目录下。当然,如果你的shell工具支持关键字高亮的话,一眼就能区分该是目录还是可执行文件了,以下是目录示例:

/run/nginx
/usr/lib64/nginx
/usr/sbin/nginx
/usr/share/nginx
/usr/libexec/initscripts/legacy-actions/nginx
/etc/logrotate.d/nginx
/etc/sysconfig/nginx
/etc/nginx
/var/lib/yum/repos/x86_64/7/nginx
/var/cache/nginx
/var/cache/yum/x86_64/7/nginx
/var/log/nginx

上述列表中,带有/sbin/或者/bin/的目录仅有一个,那就是:

/usr/sbin/nginx

找到nginx的配置文件

也就是找到nginx.conf文件,同样是使用查找命令:

find / -name nginx.conf

这个时候一般只会出现一个配置文件路径,如下:

/etc/nginx/nginx.conf

拼接命令,启动nginx

将目录/usr/sbin/nginx加上参数 -c,再加上配置文件目录:/etc/nginx/nginx.conf

最终变成了:

/usr/sbin/nginx -c /etc/nginx/nginx.conf

此时按下Enter执行,屏幕将会没有其他的提示,意味着nginx程序启动成功。

nginx -c 它是设置配置文件。其实nginx -c 它还有一个默认的配置文件路径。它默认的路径:/etc/nginx/nginx.conf,所以上述命令修正后是:

/usr/sbin/nginx -c

怎么知道nginx还有其他的命令呢?

你只需要输入以下命令即可:

/usr/sbin/nginx -?

Nginx指令拓展知识(中英对照):

-?,-h 			: this help (这个帮助)
-v : show version and exit (显示版本并退出)
-V : show version and configure options then exit (显示版本和选项,然后退出)
-t : test configuration and exit (测试配置和退出)
-T : test configuration, dump it and exit (测试配置,转储并退出)
-q : suppress non-error messages during configurationtesting (在配置非错误期间,禁止显示非错误消息)
-s signal : send signa1 to a master process: stop, quit, reopen, reload (向主进程发送信息:停止;退出;重新打开;重新加载)
-p prefix : set prefix path (default: /etc/nginx/) (设置前缀路径,默认:/etc/nginx/)
-c filename : set configuration file (default: /etc/nginx/nginx. conf) (设置配置文件,默认为:/etc/nginx/nginx. conf ) -g directives : set global directives out of configuration file (将配置文件设置为全局指令)

重启centOS丢失nginx.pid导致无法启动nginx的解决方法的更多相关文章

  1. docker安装后启动不了 解决方法

    第一种情况: 可能是你的selinux没有disabled,导致了守护docker的deamon进程启动不了 查看系统日志如果发现下列信息: May 7 12:34:14 localhost dock ...

  2. Windows 共享无线上网 无法启动ICS服务解决方法(WIN7 ICS服务启动后停止)

    Windows 共享无线上网 无法启动ICS服务解决方法(WIN7 ICS服务启动后停止) ICS 即Internet Connection Sharing,internet连接共享,可以使局域网上其 ...

  3. PHP failed to ptrace(PEEKDATA) pid 13659: Input/output error错误解决方法

    PHP failed to ptrace(PEEKDATA) pid 13659: Input/output error错误解决方法 现在改linux内核文件打开限制<pre>ulimit ...

  4. 安装sqlserver导致80端口被占用解决方法

    安装sqlserver导致80端口被占用解决方法 系统占用的端口一般都是微软官方的产品占用的.所以这个时候主要考虑到几个服务: SQL Server导致.其中很有可能是SQL Server Repor ...

  5. MySQL程序端启动密码错误解决方法

    MySQL程序端启动密码错误解决方法 一般启动MySQL程序端,都是用mysql -uroot -p命令,当然前提是你的环境变量已经配好了. 为了连接服务器,当调用mysql时,通常需要提供一个MyS ...

  6. MVC4升级MVC5导致原项目出错的解决方法

    原文:MVC4升级MVC5导致原项目出错的解决方法 出现安全透明方法"WebMatrix.WebData.PreApplicationStartCode.Start()"尝试访问安 ...

  7. 启动phpstyle Apache的80端口被win7的System PID=4的进程占用的解决方法 以及 如何在phpStyle里发布程序

    学习前端是,用到Ajax,php语言,操作mysql数据库,浏览器无法解析php代码(把源码输出):原因,我之前用的是tomcat服务器写jsp,servlet,php用的是apache服务器,没有配 ...

  8. 启动phpstyle Apache的80端口被win7的System PID=4的进程占用的解决方法

    学习前端是,用到Ajax,php语言,操作mysql数据库,浏览器无法解析php代码(把源码输出):原因,我之前用的是tomcat服务器写jsp,servlet,php用的是apache服务器,没有配 ...

  9. 安装centos后无法引导启动windows7的解决方法

    在电脑Windows7系统上安装Centos7,安装后找不到Windows7引导菜单. 原因:因为CentOS 7已采用新式的grub2系统,所以需要进入/boot/grub2目录后使用vi编辑gru ...

随机推荐

  1. Algorithm: bit manipulation

    1. 一个数的从右起第p1位和第p2位swap n位 unsigned int swapBits(unsigned int x, unsigned int p1, unsigned int p2, u ...

  2. hadoop —— MapReduce例子 (数据排序)

    参考:http://eric-gcm.iteye.com/blog/1807468 file1.txt: 2 32 654 32 15 756 65223 file2.txt: 5956 22 650 ...

  3. poj 3268 Silver Cow Party (最短路算法的变换使用 【有向图的最短路应用】 )

    Silver Cow Party Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 13611   Accepted: 6138 ...

  4. win 10 安装.msi 程序出现the error code is 2503

    解决方法: C:\Windows\temp文件夹的权限不够,需要给其更高权限 右键temp文件夹 点击属性进入属性对话框 组或用户名的里面的All APPLICATION PACKAGES和所有受限制 ...

  5. openfire调试环境

    导入工程: File->New->project: 选择“Java project from existing ant buildfile” 再从菜单windows->show vi ...

  6. struct tm 和 time_t 时间和日期的使用方法(转

    关键字:UTC(世界标准时间),Calendar Time(日历时间),epoch(时间点),clock tick(时钟计时单元) .概念 在C/C++中,对字符串的操作有很多值得注意的问题,同样,C ...

  7. scala & spark实战

    java.lang.Long is not a valid external type for schema of string   java.lang.RuntimeException: Error ...

  8. css3 实现运动动画 圆与椭圆

    圆: html <div class="demo4"><div></div></div> css .demo4{ width: 20 ...

  9. WPF系列学习之三(路由事件)

    路由事件实际上以一上 列三种方式出现.    1.与普通的.net事件类似的直接路由事件.它们起源于一个元素,并且不传递给其他元素.例如:MouseEnter事件.    2.在包含层次中向上传递的冒 ...

  10. Spring3注解零配置

    我们在以前学习 Spring 的时候,其所有的配置信息都写在 applicationContext.xml 里,大致示例如下: java代码: 查看复制到剪贴板打印     OracleDriver& ...