zoukankan      html  css  js  c++  java
  • ubuntu 12.04 server编译安装nginx

    tar -xvf zlib-1.2.8.tar.gz
    cd zlib-1.2.8
    ./config
    make
    make install
    

    above is for zlib(refers http://zlib.net/ for zlib),and below is for pcre-devel

    apt-get install libpcre3 libpcre3-dev
    

    then, compile and install nginx(get the newest stable source code from nginx.org)

    virtualenv nginx_env
    cd nginx_env
    source bin/activate
    tar -xvf nginx-1.6.2.tar.gz
    cd nginx-1.6.2
    ./configure
    make
    make install
    

    output log with "make"

    Configuration summary
    + using system PCRE library
    + OpenSSL library is not used
    + using builtin md5 code
    + sha1 library is not found
    + using system zlib library

    nginx path prefix: "/usr/local/nginx"
    nginx binary file: "/usr/local/nginx/sbin/nginx"
    nginx configuration prefix: "/usr/local/nginx/conf"
    nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
    nginx pid file: "/usr/local/nginx/logs/nginx.pid"
    nginx error log file: "/usr/local/nginx/logs/error.log"
    nginx http access log file: "/usr/local/nginx/logs/access.log"
    nginx http client request body temporary files: "client_body_temp"
    nginx http proxy temporary files: "proxy_temp"
    nginx http fastcgi temporary files: "fastcgi_temp"
    nginx http uwsgi temporary files: "uwsgi_temp"
    nginx http scgi temporary files: "scgi_temp"

    =========================test it ==========================

    /usr/local/nginx/nginx
    

     just open page 'http://127.0.0.1' in web browser and see what happens.

    and one more effort, let's try to use nginx with gunicorn.

    first, install gunicorn.

    pip install gunicorn
    

     then, django

    easy_install django
    

    next, start a project ,and run it with gunicorn

    django-admin startproject test_gn
    cd test_gn
    gunicorn -D test_gn.wsgi
    

    finally ,configure nginx

    vi /usr/local/nginx/conf/nginx.conf
    

    and add a server like below down

    server{
            listen localhost:88;
            location / {
               proxy_pass http://127.0.0.1:8000;
            }
    
            location /static/ {
                 autoindex:on;
                 alias absolute/path/to/static/dir;
             }
        }
    

     

    restart the nginx server(kill the older progress and start a new one)

    ------------------编译源码有时候不一定能解决问题---------------

    可以参考这个来升级nginx: https://www.binss.me/blog/install-lastest-nginx-on-ubuntu/

  • 相关阅读:
    openshift 调度命令
    k8s 高级调度 亲和力和反亲和力、绑定标签、污点容忍污点
    阿里云香港主机自动换IP
    python 调用阿里云服务器api创建服务器
    python 调用阿里云云解析api添加记录
    python 获取SLB信息 更换证书
    k8s 健康检查
    jenkins openshift 持续集成
    cnpm安装过程中提示optional install error: Package require os(darwin) not compatible with your platform(win32)解决方法
    Python学习笔记 chapter 2基础
  • 原文地址:https://www.cnblogs.com/Tommy-Yu/p/4036141.html
Copyright © 2011-2022 走看看