配置nginx

上一篇配置了uwsgi:https://www.cnblogs.com/kkkboshow/p/11172409.html

1.安装nginx, centos直接 

  yum install nginx

2.配置nginx

  # 进入配置目录: cd /etc/nginx/conf.d

  # 创建自己的配置文件: touch dev.conf

3.nginx 文件配置

server {
listen 80;

# 服务器名称,域名和IP地址均可以
server_name api-dev.xxx.com;

# 重定向到https,需要ssl证书
location / {
  return 301 https://api-dev.xxx.com$request_uri;
}
}
server {
  listen 443 ssl http2;
  server_name api-dev.xxxx.com;
  access_log /var/log/nginx/api-dev.xxxx.com.access.log main1;
  error_log /var/log/nginx/api-dev.xxxx.com.error.log;

  # ssl证书

  ssl on;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_session_cache builtin:1000 shared:SSL:10m;
  ssl_session_timeout 5m;
  ssl_ciphers HIGH:!aNULL:!MD5:!EXPORT:+MEDIUM;
  ssl_prefer_server_ciphers on;
  ssl_certificate banmacang.com.pem;
  ssl_certificate_key banmacang.com.key;

  gzip on;
  gzip_vary on;
  gzip_min_length 1024;
  gzip_http_version 1.0;
  gzip_types text/plain text/css application/x-javascript text/javascript application/json;

  location /doc/{
    root /projects/app-dev.banmacang.com/;
  }
  location /console-doc/{
    root /projects/app-dev.banmacang.com/;
  }
  location /bmc_app/ {
    #rewrite /bmc_app/(.*) /$1 break;
    include uwsgi_params;
    uwsgi_pass 127.0.0.1:9026;
  }
}

posted @ 2019-07-12 09:12  kkkbo1  阅读(506)  评论(0编辑  收藏  举报