zoukankan      html  css  js  c++  java
  • linux系统或centos7安装nginx

    一、Linux下安装nginx

    1、添加源

    sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

    2、安装

    sudo yum install -y nginx

    3、启动,并设置开机启动

    sudo systemctl start nginx.service
    sudo systemctl enable nginx.service

     4、进入/etc/nginx的配置文件进行配置,vim nginx.conf

    user root;
    worker_processes 1;
    events {
        worker_connections 1024;
    }
    http{
        include mime.types;
        default_type application/octet-stream;
        sendfile on;
        keepalive_timeout 65;
        server {
            listen 1010;
            autoindex on;
            location / {
                root /home/data/train;
                index index.html index.htm;
            }
        }
    }

     5、https

    user  root;
    worker_processes  1;
    events {
        worker_connections  1024;
    }
    http{
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
        server {
            listen 8888 ssl;
            server_name fstest-train.dicfin.com;
            autoindex on;
        ssl_certificate /home/web/ipcc/ssl_cert/fstest-train.dicfin.com.pem; #修改证书文件
            ssl_certificate_key /home/web/ipcc/ssl_cert/fstest-train.dicfin.com.key;  #修改证书文件
            ssl_session_timeout 5m;
            ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
            ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
            ssl_prefer_server_ciphers on;
            location / {
                root   /home/data/train;
                index  index.html index.htm;
            }
         }
    }

     二、windows下启动

    1、启动命令,cmd下依次输入

    E:
    cd E:\nginx-1.18.0
    taskkill /f /t /im nginx.exe
    nginx.exe

     2、如果修改了配置文件,可以用以下命令生效

    nginx -s reload

     3、关闭nginx

    pkill -9 nginx
  • 相关阅读:
    如何定时备份Mysql数据库
    Mysql如何分析慢查询及优化(一)--- EXPLAIN详解
    Mysql如何分析慢查询日志--MysqlDumpSlow详解
    Mysql添加用户及用户权限管理
    Mysql表的横向拆分与纵向拆分及简单案例
    Mysql触发器详解以及简单的案例
    Mysql存储过程详解及案例
    Mysql中如何查看线程
    Nginx命令与配置详解
    SQLSERVER 2008 技术内幕 T-SQL查询 笔记1: SQL 执行顺序
  • 原文地址:https://www.cnblogs.com/zhangxianrong/p/13531769.html
Copyright © 2011-2022 走看看