nginx怎么配置https访问

一、安装nginx

yum  -y install nginx

二、准备证书

申请证书,并将证书上传到/etc/pki/nginx/目录,证书可以在腾讯云等云平台申请

二、配置nginx

user  root;
worker_processes  auto;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

	# 开启gzip压缩
	gzip on;
	# 不压缩临界值,大于1K的才压缩,一般不用改
	gzip_min_length 1k;
	# 压缩缓冲区
	gzip_buffers 16 64K;
	# 压缩版本(默认1.1,前端如果是squid2.5请使用1.0)
	gzip_http_version 1.1;
	# 压缩级别,1-10,数字越大压缩的越好,时间也越长
	gzip_comp_level 5;
	# 进行压缩的文件类型
	gzip_types text/plain application/x-javascript text/css application/xml application/javascript;
	# 跟Squid等缓存服务有关,on的话会在Header里增加"Vary: Accept-Encoding"
	gzip_vary on;
	# IE6对Gzip不怎么友好,不给它Gzip了
	gzip_disable "MSIE [1-6]\.";

	# 配置 80 端口
    ser

相关推荐

  1. nginx怎么配置https访问

    2024-04-02 03:02:01       32 阅读
  2. nginx-http-flv配置

    2024-04-02 03:02:01       36 阅读
  3. nginx配置访问出现白屏怎么办

    2024-04-02 03:02:01       31 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-02 03:02:01       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-02 03:02:01       100 阅读
  3. 在Django里面运行非项目文件

    2024-04-02 03:02:01       82 阅读
  4. Python语言-面向对象

    2024-04-02 03:02:01       91 阅读

热门阅读

  1. [lesson01]学习C++的意义

    2024-04-02 03:02:01       35 阅读
  2. Pytorch实用教程: torch.tensor()的用法

    2024-04-02 03:02:01       35 阅读
  3. js的date对象有什么用

    2024-04-02 03:02:01       36 阅读
  4. 【开发总结】electron浏览器打开踩坑

    2024-04-02 03:02:01       33 阅读
  5. Spring 事物原理及工作原理

    2024-04-02 03:02:01       31 阅读
  6. 343. 整数拆分(力扣LeetCode)

    2024-04-02 03:02:01       32 阅读
  7. #git 撤消对文件的更改

    2024-04-02 03:02:01       32 阅读
  8. MySQL 入门教程

    2024-04-02 03:02:01       35 阅读
  9. C#WPF控件大全

    2024-04-02 03:02:01       33 阅读
  10. 7.公约移动

    2024-04-02 03:02:01       37 阅读