zoukankan      html  css  js  c++  java
  • Nginx基本使用

    Nginx基本使用

    下载源码包http://nginx.org/

    http://nginx.org/en/download.html

    yum -y install pcre-devel openssl openssl-devel
    sudo yum -y install pcre-devel openssl openssl-devel
    yum -y install gcc
    yum -y install gcc-c++

    [root@t-fxj01-v-szzb ~]# groupadd www
    [root@t-fxj01-v-szzb ~]# useradd -r -g www -s /sbin/nologin -M www

    yum  -y install "@开发工具" pcre  pcre-devel  openssl openssl-devel
    
    tar -zxvf nginx-XXXX.tar.gz
    
    ./configure --help
    
    ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module
    
    make && make install
    
    useradd -s /sbin/nologin  -M  www
    
    /usr/local/nginx/sbin/nginx 选项
    -h
    -s stop 停止nginx进程
    -v 查看软件版本
    -V 安装软件时的配置参数
    -c 指定nginx进程使用那个配置文件运行
    -t 检查默认的配置文件nginx.conf是否有语法错误
    
    pkill   -9 nginx
    
    kill 信号 pid号
    -int
    -quit
    -HUP
    -USR1
    -USR2
    -WINCH
    kill   -HUP  `cat /usr/local/nginx/logs/nginx.pid`
    

     基本网站服务

    http {
    
    server {
    listen 80;
    server_name localhost;
    
    location / {
    root html;
    index index.html;
    }
    
    location 路径 {
    root html;
    index index.html;
    }
    }
    
    server {
    
    }
    }
    

     基于域名的虚拟主机 : 发布给公网客户端

    基于端口 + 基于ip : 在私有网络发布网站后台管理页面

    1.域名虚拟主机

    server {
    listen 80;
    server_name www.xzdz.hk;
    location / {
    root /wwwdir;
    index index.html index.htm;
    }
    .....
    .....
    }
    server {
    listen 80;
    server_name bbs.xzdz.hk;
    location / {
    root /bbsdir;
    index index.html;
    }
    }
    

    2.端口虚拟主机

    server {
    listen 80;
    location / {
    root html;
    index index.html;
    }
    }
    
    server {
    listen 8000;
    location / {
    root /bbsdir;
    index index.html;
    }
    
    server {
    listen 8090;
    location / {
    root /wwwdir;
    index index.html;
    }
    }
    

    3.ip虚拟主机

    server {
    listen 1.1.1.253:8080;
    location / {
    root /admindir;
    index index.html;
    }
    }
    server {
    listen 1.1.1.254:80;
    location / {
    root /wwwdir;
    index index.html;
    }
    }
    server {
    listen 1.1.1.253:80;
    location / {
    root /bbsdir;
    index index.html;
    }
    }
    

     

    公众号请关注:侠之大者
  • 相关阅读:
    Classic Source Code Collected
    Chapter 2 Build Caffe
    蓝屏代码大全 & 蓝屏全攻略
    AMD C1E SUPPORT
    DCU IP Prefether
    DCU Streamer Prefetcher
    adjacent cache line prefetch
    Hardware Prefetcher
    Execute Disable Bit
    Limit CPUID MAX
  • 原文地址:https://www.cnblogs.com/kamil/p/5167368.html
Copyright © 2011-2022 走看看