nginx(一)安装与命令总结
2016-07-19 00:00
706 查看
摘要: nginx(一)安装与命令总结
1.mac 安装在命令行中输入以下命令, 前提安装好brew
2.Linux centos安装linux
先需要安装源:
启动nginx
常用命令总结:
原因是:nginx -s reload is only used to tell a running nginx process to reload its config. After a stop, you don't have a running nginx process to send a signal to. Just run nginx (possibly with a -c /path/to/config/file)
可通过下面命令来启动nginx
2.运行service nginx start 启动nginx出现Starting nginx: nginx: [emerg] open() "/var/run/nginx.pid" failed (13: Permission denied) 是因为权限的设置问题导致
可通过下面命令来启动nginx
3. 启动nginx 有可能出现下面的错误 Starting nginx: nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)解决方案修改/etc/nginx/conf.d/default.conf为 删除listen [::]:80 default_server;
修改之后的结果为
通过下面命令查看nginx服务是否启动
看到下面的信息说明nginx安装成功了
下面就开启学习nginx之旅吧!
nginx(一)安装与命令总结
不同平台上安装nginx1.mac 安装在命令行中输入以下命令, 前提安装好brew
brew install nginx
2.Linux centos安装linux
先需要安装源:
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm yum install nginx
启动nginx
service nginx start
常用命令总结:
nginx -t;//检查配置文件nginx.conf是否正确 nginx -s reload;//重载配置 nginx -c /etc/nginx/nginx.conf;//启动nginx ps -ef|grep nginx;//查看nginx进程 service nginx start;//启动nginx service nginx stop;//关闭nginx
常见问题解决方案
1.很多时候我们nginx -s reload 会出现 nginx: [error] invalid PID number "" in "/var/run/nginx.pid"原因是:nginx -s reload is only used to tell a running nginx process to reload its config. After a stop, you don't have a running nginx process to send a signal to. Just run nginx (possibly with a -c /path/to/config/file)
可通过下面命令来启动nginx
nginx -c /etc/nginx/nginx.conf
2.运行service nginx start 启动nginx出现Starting nginx: nginx: [emerg] open() "/var/run/nginx.pid" failed (13: Permission denied) 是因为权限的设置问题导致
可通过下面命令来启动nginx
nginx -c /etc/nginx/nginx.conf
3. 启动nginx 有可能出现下面的错误 Starting nginx: nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)解决方案修改/etc/nginx/conf.d/default.conf为 删除listen [::]:80 default_server;
listen 80; listen [::]:80 default_server;
修改之后的结果为
listen 80; server_name _;
通过下面命令查看nginx服务是否启动
ps -ef|grep nginx
看到下面的信息说明nginx安装成功了
[root@VM_30_103_centos etc]# ps -ef|grep nginx root 3294 1 0 Jun21 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf root 27118 3294 1 13:57 ? 00:00:00 nginx: worker process root 27119 3294 0 13:57 ? 00:00:00 nginx: worker process root 27120 3294 1 13:57 ? 00:00:00 nginx: worker process root 27121 3294 0 13:57 ? 00:00:00 nginx: worker process root 27123 26467 0 13:57 pts/0 00:00:00 grep nginx
下面就开启学习nginx之旅吧!
相关文章推荐
- nginx代理指定目录
- 访问Nginx发生SSL connection error的一种情况
- Nginx+Naxsi部署专业级Web应用防火墙
- CentOS 6.2实战部署Nginx+MySQL+PHP
- nginx中http核心模块的配置指令2
- nginx中http核心模块的配置指令3
- nginx中http核心模块的配置指令4
- nginx中http的fastcgi模块的配置指令1
- Nginx 学习笔记(一)
- 网站502与504错误分析
- 用zabbix监控nginx_status状态
- 艰难完成 nginx + puma 部署 rails 4的详细记录
- 把Lua编译进nginx步骤方法
- web 应用中常用的各种 cache详解
- Linux系统上配置Nginx+Ruby on Rails+MySQL超攻略
- window+nginx+php环境配置 附配置搭配说明
- 解析CI即CodeIgniter框架在Nginx下的重写规则
- 将PHP从5.3.28升级到5.3.29时Nginx出现502错误
- 基于Nginx0.8.54+PHP5.3.4+MySQL5.5.8的全新LNMP稳定版架构搭建的VPS