zoukankan      html  css  js  c++  java
  • ubutun中安装nginx

    一、安装

    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。。。 仿照上面写就可以了

     
     
  • 相关阅读:
    zabbix监控系统客户端安装
    可以学习的博客地址
    Linux下Nagios的安装与配置
    ShopNC多用户商城标题去版权 后台去版权方法2.0版本
    解析crontab php自动运行的方法
    暑假周报告(第五周)
    暑假周报告(第四周)
    暑假周报告(第三周)
    暑假周报告(第二周)
    《大道至简》读后感
  • 原文地址:https://www.cnblogs.com/bluewelkin/p/4193725.html
Copyright © 2011-2022 走看看