安装nginx
1、安装依赖项
sudo apt-get update
sudo apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev libssl-dev libxslt1-dev libxml2-dev libgd2-xpm-dev libgeoip-dev libgoogle-perftools-dev libperl-dev libtool libpcrecpp0v5 openssl -y
2、下载nginx
wget http://nginx.org/download/nginx-1.13.5.tar.gz && tar -xf nginx-1.13.5.tar.gz
3、编译安装
# 进入解压目录:
cd nginx-1.13.5
# 配置:这里额外安装几个模块
 
./configure --sbin-path=/usr/local/nginx/nginx \
--prefix=/usr/local/nginx \
--conf-path=/usr/local/nginx/nginx.conf \
--pid-path=/usr/local/nginx/nginx.pid \
--add-module=../nginx-rtmp-module-master \
--with-http_ssl_module \
--with-stream --with-mail=dynamic
 
# 编辑安装nginx:
 
sudo make && sudo make install
 
# 启动nginx:
sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
 
#注意:-c 指定配置文件的路径,不加的话,nginx会自动加载默认路径的配置文件,可以通过 -h查看帮助命令。
 
# 查看nginx进程:
ps -ef | grep nginx
 
# 建立软链接(由于/usr/local/bin包含于$PATH当中,这样就不需要额外的设置环境变量了,这意味着可以在其他路径下直接运行nginx命令)
sudo ln -s /opt/dotnet/dotnet /usr/local/bin #(创建链接)
 
附录
 编译选项说明:
--prefix=path 如果在编译的不指定安装位置,那么默认的位置/usr/local/nginx目录
--sbin-path=path 设置nginx执行脚本的位置,默认位置${prefix}/sbin/nginx  注意这里的prefix是在配置文件里面配置的路径
--conf-path=path 配置nginx配置文件的路径,如果不指定这个选项,那么配置文件的默认路径就会是 ${prefix}/conf/nginx.conf
--pid-path =path 配置nginx.pid file的路径,一般来说,进程在运行的时候的时候有一个进程id,这个id会保存在pid file里面,默认的pid file的放置位置是prefix/logs/nginx.pid
--error-log-path=path 设置错误日志的存放路径,默认${prefix}/logs/error.log
--http-log-path= path 设置http访问日志的路径,就默认${prefix}/logs/access.log
--user=name 设置默认启动进程的用户,如果不指定,就默认 nobody
--group=name 设置这个用户所在的用户组,如果不指定,依然是nobody
--with-http_ssl_module 开启HTTP SSL模块,使NGINX可以支持HTTPS请求。需要安装OPENSSL
--with-http_flv_module
--with-http_stub_status_module 启用 "server status" 页
--without-http_gzip_module 禁用 ngx_http_gzip_module. 如果启用,需要 zlib
--without-http_ssi_module 禁用 ngx_http_ssi_module
--without-http_referer_module 禁用 ngx_http_referer_module
--without-http_rewrite_module 禁用 ngx_http_rewrite_module. 如果启用需要 PCRE 。
--without-http_proxy_module 禁用 ngx_http_proxy_module
--without-http_fastcgi_module 禁用 ngx_http_fastcgi_module
--without-http_memcached_module 禁用 ngx_http_memcached_module
--without-http_browser_module 禁用 ngx_http_browser_module
--http-proxy-temp-path=PATH 设置路径到the http proxy temporary files
--http-fastcgi-temp-path=PATH 设置路径到Set path to the http fastcgi temporary files
--without-http 禁用 HTTP server
--with-mail 启用 IMAP4/POP3/SMTP 代理模块
--with-mail_ssl_module 启用ngx_mail_ssl_module
--with-openssl=DIR 设置路径到OpenSSL library sources
--with-stream 用来实现四层协议的转发、代理或者负载均衡等
 测试 nginx
在浏览器中输入 带有运行nginx服务的机子的 IP地址,端口号要参考 conf文件 中 listen 的端口号
  1. server {
  2. listen ;
  3. server_name localhost;
  4.  
  5. #charset koi8-r;
  6.  
  7. #access_log logs/host.access.log main;
  8.  
  9. location / {
  10. root html;
  11. index index.html index.htm;
  12. }
 
 
 

Ubuntu 编译安装 nginx的更多相关文章

  1. Ubuntu编译安装nginx,php,mysql

    摘要: 整理的Ubuntu编译安装nginx,php,mysql的步骤,主要来自对驻云的sh-1.4.1中脚本的整理,随时代进步,内容中的软件或者命令请自行更新 目录准备 创建用户 userdel w ...

  2. Ubuntu编译安装nginx以及配置自动启动

    本文主要介绍ubuntu如何编译安装nginx以及遇到的问题 和 配置系统自动启动服务 查看操作系统版本 cat /etc/issue  Ubuntu 18.04.3 LTS \n \l    更改镜 ...

  3. ubuntu编译安装nginx

    下载nginx源码, ./configure --prefix=/usr/local/nginx/1.8 --with-http_ssl_module --with-http_dav_module - ...

  4. Windows 编译安装 nginx 服务器 + rtmp 模块

    有关博客: <Windows 编译安装 nginx 服务器 + rtmp 模块>.<Ubuntu 编译安装 nginx>.<Arm-Linux 移植 Nginx> ...

  5. ubuntu 12.04 编译安装 nginx

    下载源码包 nginx 地址:http://nginx.org/en/download.html 编译前先安装两个包: 直接编译安装会碰到缺少pcre等问题,这时候只要到再安装两个包就ok sudo ...

  6. ubuntu 14.04 编译安装 nginx

    下载源码包 nginx 地址:http://nginx.org/en/download.html  下载nginx 1.4.7 编译前先安装两个包: 直接编译安装会碰到缺少pcre等问题,这时候只要到 ...

  7. Ubuntu 16.04源码编译安装nginx 1.10.0

    一.下载相关的依赖库 pcre 下载地址 http://120.52.73.43/jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.t ...

  8. Ubuntu下安装Nginx,PHP5(及PHP-FPM),MySQL

    .简介: Tomcat在高并发环境下处理动态请求时性能很低,而在处理静态页面更加脆弱.虽然Tomcat的最新版本支持epoll,但是通过Nginx来处理静态页面要比通过Tomcat处理在性能方面好很多 ...

  9. LNMP搭建02 -- 编译安装Nginx

    [编译安装Nginx]   为了顺利安装Nginx,先安装下面这些: [CentOS 编译 nginx 前要做的事情] yum install gcc gcc-c++ kernel-devel yum ...

随机推荐

  1. ZROI 2020WC集训训练赛 Day4

    最后一场,幸好没有掉分,假装功德圆满吧. T1有各种数据结构做法,主要难点在优化空间. T2直接DP就完事了,然而记搜的复杂度是对的-- T3神仙最小割. 没错这篇文章就是咕了. pkuwc rp++ ...

  2. x64下进程保护HOOK

    目录 x64(32)下的进程保护回调. 一丶进程保护线程保护 1.简介以及原理 1.2 代码 1.3注意的问题 二丶丶回调函数写法 2.1 遇到的问题. 2.2 回调代码 x64(32)下的进程保护回 ...

  3. SQL Mode

    SQL Mode简介 在MySQL中,SQL Mode常常用来解决以下问题: 1.通过设置SQL Mode,可以完成不同严格程度的数据校验,有效保证数据准确性. 2.通过设置SQL Mode为ANSI ...

  4. Unknown column 'startname' in 'field list

    Unknown column 'startname' in 'field list  字段匹配不上 解决思路 1.检查数据库字段名与sql中的字段名是否一致 2.是否为关键字或中英文区别 ,(关键字可 ...

  5. 第08组 Beta冲刺(4/4)

    队名 八组评分了吗 组长博客链接(5分) ( https://www.cnblogs.com/leemelon/p/12040924.html ) 作业博客 [作业链接] (https://edu.c ...

  6. python 文字转语音

    # coding=utf-8 import pyttsx3 text='I love you 韩长菊' voice=pyttsx3.init() voice.say(text) voice.runAn ...

  7. SpringBoot——配置文件占位符

    在配置文件中采用: ${random.int} 获取一个随机值.

  8. hive删除空分区

    当hive中分区字段有NULL值时,hive会使用dynamic partition,数据会放到一个特殊的分区,这个分区由参数“hive.exec.default.partition.name”控制, ...

  9. pipenv使用学习

    参考https://realpython.com/pipenv-guide/#package-distribution Pipenv: A Guide to the New Python Packag ...

  10. SpringBoot入门-Redis(六)

    依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spri ...