zoukankan      html  css  js  c++  java
  • centos7 安装 nginx

    环境依赖

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

    下载压缩包

    wget https://nginx.org/download/nginx-1.14.0.tar.gz

    解压

    tar zxvf nginx-1.14.0.tar.gz

    configure

    ./configuare

    编译和编译安装

    make && make install

    服务启动

    ./nginx

    查看是否启动

    • 查进程 ps aux | grep nginx
    • 输入地址看效果

    平滑启动

    ./nginx -s reload

    nginx的配置文件 /usr/local/nginx/config/nginx.conf

    #user  nobody;
    worker_processes  1;
    
    #error_log  logs/error.log;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;
    
    #pid        logs/nginx.pid;
    
    
    events {
        worker_connections  1024;
    }
    http {
        include       mime.types;
        default_type  application/octet-stream;
    
        #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
        #                  '$status $body_bytes_sent "$http_referer" '
        #                  '"$http_user_agent" "$http_x_forwarded_for"';
    
        #access_log  logs/access.log  main;
    
        sendfile        on;
        #tcp_nopush     on;
    
        #keepalive_timeout  0;
        keepalive_timeout  65;
    
        gzip  on;  # 后端给前端提供数据的时候,是否将数据进行压缩。
    
        server {
            listen       80;
            server_name  localhost;
            location / {
                root   /home;
                index  index.html index.htm;
            }
        }
        
        include  vhost/*.conf; # 以后将server可以写在这个目录里
        
     }
    # api.conf
    server {
            listen       80;
            server_name  localhost;
            location / {
                root   /home;
                index  index.html index.htm;
            }
        }
  • 相关阅读:
    kolla
    lbaas
    celery
    redis发布订阅
    数据库简单介绍
    celery
    ansible初识
    315
    request
    navicat连接mysql报错1251解决方案
  • 原文地址:https://www.cnblogs.com/lishanglin/p/12555905.html
Copyright © 2011-2022 走看看