Nginx 的安装 与 启动
没有图文说明,是我看着视频一步一步照做的,安装过程了,也随便把步骤记录下来了。
我是新装 Linux 服务器,所以安装过程中出现的错误也是第一遇到,希望对你们有所帮助。
也是方便自己以后再次安装 nignx的时候也可以看我博客了。2019-01-06
-------------------------------------------------------------安装 nginx-------------------------------------------------------------
进入 /usr/local/src 目录
# cd /usr/local/src
下载 nginx 安装包
# wget http://nginx.org/download/nginx-1.14.2.tar.gz
进行解压
# tar zxvf nginx-1.14.2.tar.gz
安装到指定目录
# ./configure --prefix=/usr/local/nginx
安装过程中如果出现这个错误
./configure: error: C compiler cc is not found
解决方案如下
yum -y install gcc gcc-c++ autoconf automake make
如果出现这个错误
./configure: error: the HTTP rewrite module requires the PCRE library
...
statically from the source with nginx by using --with-pcre=<path> option.
解决方案 nginx 依赖于 pcre 所以我们要安装 pcre
# yum install pcre
# yum install pcre-devel
如果安装过程中出现
./configure: error: the HTTP gzip module requires the zlib library.
...
statically from the source with nginx by using --with-zlib=<path> option.
解决方案如下
yum install -y zlib-devel
成功提示信息如下
Configuration summary
+ using system PCRE library
...
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
接下来我们就进行编译
make && make install
到了这里我们的nginx 也就安装成功了
-------------------------------------------------------------启动 nginx-------------------------------------------------------------
我们进入nginx目录下
# cd /usr/local/nginx
看到 四个目录
--conf 配置文件
--html 网页文件
--logs 日志文件
--sbin 进程文件
那么我们启动就得找 进程文件 这样就启动了
# ./sbin/nginx
但是注意 nginx 默认端口 是80,以下信息则是80端口被占用
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
方案一:我们可以更改默认端口
# cd /conf
# vi nginx.conf
将80 更改成你想设置的端口号就行了
server {
listen 80;
下面的省略...
方案二:关闭80端口
查看所有端口
# netstat -antp
关闭80端口 对应的PID 如:17789
# kill -9 17789
重新启动就可以了。
好了,就分享这么多,完成了简单的安装和启动,那么接下来的学习就靠我们自己了。
Nginx 的安装 与 启动的更多相关文章
- 第四百零二节,Django+Xadmin打造上线标准的在线教育平台—生产环境部署,uwsgi安装和启动,nginx的安装与启动,uwsgi与nginx的配置文件+虚拟主机配置
第四百零二节,Django+Xadmin打造上线标准的在线教育平台—生产环境部署,uwsgi安装和启动,nginx的安装与启动,uwsgi与nginx的配置文件+虚拟主机配置 软件版本 uwsgi- ...
- nginx 的安装、启动、停止与重启
一.nginx 基本介绍 1.Nginx 是单进程单线程模型,也就是启动的工作进程只有一个线程响应客户端请求,而 apache 可以在一个进程内启动多个线程响应客户端请求.所以 nginx 的内存占用 ...
- nginx的安装和启动
https://www.cnblogs.com/wyd168/p/6636529.html nginx开机启动 https://www.cnblogs.com/gimin/p/8893559.html
- nginx学习与配置-安装与启动关闭管理
nginx服务器的安装 安装准备: nginx依赖于pcre库,要先安装pcre yum install pcre pcre-devel cd /usr/local/src/ wget wget ht ...
- Nginx - Windows下Nginx初入门,附CentOS下Nginx的安装
公司刚使用nginx,预先学习下.鉴于机器没有Linux环境,在Windows熟悉下. 下载 目前(2015-07-11),nginx的稳定版本是1.8.0,在官网下载先,windows版的nginx ...
- nginx学习(1):编译、安装、启动
一.下载 从官网http://nginx.org/en/download.html 下载稳定版(目前最新稳定版是1.6.2) 二.解压 tar zxf nginx-1.6.2.tar.gzcd ngi ...
- (Nginx学习一)安装和启动及对应文件夹介绍
nginx 安装和启动及对应文件夹介绍 1 安装 官网下载nginx文件 http://nginx.org/en/download.html 解压即可 2 文件夹介绍 在解压后nginx压缩包后发现 ...
- linux 安装与启动nginx
linux系统为Centos 64位 一.去http://nginx.org/download/上下载相应的版本下载nginx-1.8.0.tar.gz(注:还有更高版本的). 二.解压 tar -z ...
- Nginx 安装学习笔记(1.安装和启动)
centos7 编译安装和启动.停止https://www.cnblogs.com/xingyunblog/p/9072553.html 一.安装nginx 1.下载 wget http://ngin ...
随机推荐
- Linux查找字符串命令grep(转)
Linux grep命令用于查找文件里符合条件的字符串. grep指令用于查找内容包含指定的范本样式的文件,如果发现某文件的内容符合所指定的范本样式,预设grep指令会把含有范本样式的那一列显示出来. ...
- HDU 5186
easy !! #include <iostream> #include <cstdio> #include <algorithm> #define LL __in ...
- HDU 3002
无向图最小割. #include <iostream> #include <cstdio> #include <cstring> using namespace s ...
- 【cl】selenium实例2:打开百度,输入hello world
/*创建的类为junit class*/ package Selenium_lassen; import static org.junit.Assert.*; import java.io.File; ...
- CharsRefIntHashMap并不比HashMap<String, Integer>快
我模仿lucene的BytesRef写了一个CharsRefIntHashMap,实測效果并不如HashMap<String, Integer>.代码例如以下: package com.d ...
- 火狐Vimperator插件
http://www.iplaysoft.com/vimium-and-vimperator.html http://wangbixi.com/x2923/comment-page-1/
- 第18章 Redis数据结构常用命令
18-1 字符串的一些基本命令 18-1 :配置Spring关于Redis字符串的运行环境 <bean id="poolConfig" class="redis.c ...
- 2.2.3 修改JSX代码
/** * Sample React Native App * https://github.com/facebook/react-native * @flow */ import React, { ...
- Chrome 行情抓取插件
Chrome 行情抓取插件 上班想偷偷摸摸看行情?自己动手写插件啊,尝试写了一个,新建文件夹,命名为StockMonitor,放入文件如下: 3个.png图标文件,19X19.48X48.128X12 ...
- hihoCoder挑战赛31
#1595 : Numbers 时间限制:8000ms 单点时限:1000ms 内存限制:256MB 描述 给定n个整数常数c[1], c[2], ..., c[n]和一个整数k.现在需要给2k个整数 ...