一、安装

sudo wget http://nginx.org/download/nginx-1.4.4.tar.gz

sudo tar zxvf ng。。。。
cd nginx-1.4.4
sudo ./configure
sudo make
sudo make install

--------------------

./configure: error: the HTTP rewrite module requires the PCRE library.

---------------------------------------

解决方法:

安装nginx依赖包运行命令:

sudo apt-get install libssl-dev
sudo apt-get install libpcre3 libpcre3-dev

2014/12/29 05:04:14 [error] 11808#0: open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)

---------------------

解决方法:
[root@localhost nginx]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
 
使用nginx -c的参数指定nginx.conf文件的位置
"/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)错误,进到logs文件发现的确没有nginx.pid文件
二、输入ip 出现 welcome to nginx 就代表ok
三、nginx配置文件所在目录/usr/local/nginx/conf/nginx.conf【转发端口】
  server {
listen 85;
#Allow file uploads
client_max_body_size 50M;

location / {
  proxy_pass http://10.10.3.99:81;
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;

}
}

 
 
 
四、 sudo /usr/local/nginx/sbin/nginx -s reload 重启nginx
 
 
 
 
五、nginx 转发多个端口【和server要并联噢,就是重写一个,不在原来的括号里面】

server {
        listen       83;
        server_name  localhost;

#charset koi8-r;

#access_log  logs/host.access.log  main;

location / {
    proxy_pass http://10.10.3.99:83;
                        proxy_pass_header Server;
                        proxy_set_header Host $http_host;
                        proxy_set_header X-Real-IP $remote_addr;
                        proxy_set_header X-Scheme $scheme;

}
}

六、让普通用户拥有root权限

sudo vim /etc/sudoers

然后 ggm=  All。。。 仿照上面写就可以了

 
 

ubutun中安装nginx的更多相关文章

  1. 在CentOS 7中安装nginx服务器

    简要地介绍一下,如何在CentOS 7中安装nginx服务器  下载对应当前系统版本的nginx包(package) # wget  http://nginx.org/packages/centos/ ...

  2. 在win10 docker启动的centos容器中安装nginx

    我是在win10机器上搭建了一个docker,在docker启动了centos容器,在centos中安装nginx. 安装配置docker 直接在官网下载docker for windows:http ...

  3. Windows2012中安装Nginx并创建为Windows服务

    安装Nginx 下载windows版nginx (http://nginx.org/download/nginx-1.10.0.zip),之后解压到需要放置的位置(D:\xampp\nginx) 将N ...

  4. 【Asp.net Core】在 Linux 子系统中安装 nginx 并配置反向代理

    上一篇鸟文中,老周已经介绍过在 Ubuntu 子系统中安装 dotnet-sdk 的方法,本文老周给大伙伴们说说安装 nginx 服务,并配置反向代理.同样,老周假设你从来没有用过 Linux,所以老 ...

  5. Nginx系列篇一:linux中安装Nginx

    提示: 如遇到yum或者wget的问题, 请详见--->杂集:更换centos yum源 请详见--->杂集:关于VMware中linux使用NAT模式配置 1.安装nginx需要的环境 ...

  6. 在linux中安装nginx

    linux系统安装在vmware中,首先在主机中利用shell工具与虚拟机连接 1.在linux中查看虚拟机的ip地址 在终端输入 ifconfig 红框里面就是ip地址 2.在主机中打开shell工 ...

  7. CentOS中安装Nginx

    一.背景 最近在写一些自己的项目,用到了nginx,所以自己动手来在Centos7上安装nginx,以下是安装步骤. 二.基本概念以及应用场景 1.什么是nginx Nginx是一款使用C语言开发的高 ...

  8. CentOS 中安装nginx

    Centos6.8 yum  安装 nginx  1:使用yum安装nginx,安装nginx库 [root@hadoop110 //]# rpm -Uvh http://nginx.org/pack ...

  9. nginx - ubutun下安装nginx(详述编译方法)

    一.使用apt命令安装 sudo apt-get install nginx 二.编译方法安装(个人实践方法,具体见官方文档) 1)说明:我使用的虚拟机是64位 ubuntu server14.04, ...

随机推荐

  1. DataGrid loadData loadFilter

    <!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Cl ...

  2. XE8 hash

    c++builder  xe8 hash calc md5.sha256.sha384.sha512 file and string sha256.sha384.sha512  must call l ...

  3. Linux下的hostname命令详解

    1.临时修改: #hostname ***** //*****为修改的hostname 2.永久修改: # vi /etc/sysconfig/networkNETWORKING=yesHOSTNAM ...

  4. Struts – Multiple configuration files example

    Many developers like to put all Struts related stuff (action, form) into a single Struts configurati ...

  5. Keil MDK Code、RO-data、RW-data、ZI-data数据段

      Program Size: Code=10848 RO-data=780 RW-data=372 ZI-data=868   Code 表示程序代码指令部分 存放在Flash区 RO-data 表 ...

  6. python安装(windows)

    1.python安装(windows) 1.1 下载安装包 https://www.python.org/downloads/ 1.2 安装 python2.7默认安装路径:C:\python27 注 ...

  7. 转载 在 Linux 虚拟机中手动安装或升级 VMware Tools

    http://pubs.vmware.com/workstation-12/index.jsp?lang=zh_CN&topic=/com.vmware.ws.using.doc/GUID-0 ...

  8. C#使用SMTP发送邮件

    需要用到的命名空间: using System.Net.Mail; using System.IO; using System.Text.RegularExpressions; using Syste ...

  9. Labeled ContentControl & LabeledControl【项目】

    LabeledTextBoxControl: C#定义 using System; using System.Collections.Generic; using System.Linq; using ...

  10. Oracle复制表结构和表数据

    一, 复制表结构及数据 create table z_xudebiao_test as select * from v_topic v where v.adddate > to_date('20 ...