• Nginx-1.6.3源码安装、虚拟主机


    源码安装nginx

    cat /etc/redhat-release
    uname -rm
    yum install pcre-devel openssl-devel -y
    rpm -qa pcre pcre-devel openssl openssl-devel
    groupadd -g 888 nginx
    useradd nginx -u 888 -g nginx -s /sbin/nologin -M
    mkdir -p /server/tools
    cd /server/tools
    wget -q http://nginx.org/download/nginx-1.6.3.tar.gz
    tar xf nginx-1.6.3.tar.gz
    cd nginx-1.6.3
    ./configure --user=nginx --group=nginx --prefix=/application/nginx-1.6.3 --with-http_stub_status_module --with-http_ssl_module
    make
    make install
    ln -s /application/nginx-1.6.3 /application/nginx
    /application/nginx/sbin/nginx -t
    /application/nginx/sbin/nginx
    ps -ef | grep nginx
    lsof -i :80 
    curl 10.0.0.41
    

    虚拟主机配置

    cd /application/nginx-1.6.3/conf/
    egrep -v "^$|#" nginx.conf.default > nginx.conf
    mkdir extra
    mkdir ../html/{www,blog,bbs}
    chown -R nginx.nginx ../html
    vim nginx.conf
    
    worker_processes  1;
    error_log logs/error.log error;
    events {
        worker_connections  1024;
    }
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
        log_format main '$remote_addr - $remote_user [$time_local] "$request"'
                        '$status $body_bytes_sent "$http_referer"'
                        '"$http_user_agent" "$http_x_forwarded_for"';
        include extra/www.conf;
        include extra/blog.conf;
        include extra/bbs.conf;
        include extra/status.conf;
    }
    
    vim extra/www.conf
    
    server {
            listen       80;
            server_name  www.peterwang.com;
            root html/www;
            index index.html index.htm;
            error_page   500 502 503 504  /50x.html;
            access_log logs/access_www.log main;
            location / {
            
            }
        }
    
    vim extra/blog.conf
    
    server {
            listen       80;
            server_name  blog.peterwang.com;
            root html/blog;
            index index.html index.htm;
            error_page   500 502 503 504  /50x.html;
            access_log logs/access_blog.log main;        
            location / {
            
            }
        }
    
    vim extra/bbs.conf
    
    server {
            listen       80;
            server_name  bbs.peterwang.com;
            root html/bbs;
            index index.html index.htm;
            error_page   500 502 503 504  /50x.html;
            access_log logs/access_bbs.log main;
            location / {
            
            }
        }
    
    vim extra/status.conf
    
    server {
            listen       80;
            server_name  status.peterwang.com;
            location / {
            stub_status on;
            access_log off;
            allow 10.0.0.0/24;
            deny all;
            }
        }
    
    ../sbin/nginx -s reload
    
  • 相关阅读:
    nc之二:nc命令详解
    memcache redundancy机制分析及思考
    memcache和redis区别
    java操作mongodb
    Memcache缓存与Mongodb数据库的优势和应用
    memcache 存储单个KEY,数据量过大的时候性能慢!以及简单的memcache不适合用到的场景
    pkill详解
    修改linux用户密码
    Mysql函数INSTR、LOCATE、POSITION VS LIKE
    Servlet3.0之九:web模块化
  • 原文地址:https://www.cnblogs.com/Peter2014/p/7512449.html
Copyright © 2020-2023  润新知