zoukankan      html  css  js  c++  java
  • 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
    
  • 相关阅读:
    sync.WaitGroup golang并发调度器
    Golang New 关键字的小bug 未找到原因(暂时)
    zabbix监控websphere的几个监控项
    zabbix监控AIX DB2数据库
    NOIP2008P 排座椅
    解题报告—— 2018级2016第二学期第五周作业 删数问题
    解题报告——2018级2016第二学期第五周作业排座椅
    解题报告——2018级2016第二学期第四周作业 (2的幂次方)
    解题报告——-2018级2016第二学期第三周作业
    解题报告——2018级2016第二学期第二周作业
  • 原文地址:https://www.cnblogs.com/Peter2014/p/7512449.html
Copyright © 2011-2022 走看看