【Nginx配置开启HTTP2支持】教程文章相关的互联网学习教程文章

nginx 配置两个Vue项目 名称不同【图】

1.修改vue.config.js 中的 publicPath 值 使名称与后面nginx配置的路径名相同 2.修改rotuer文件夹下面的index.js 新增base属性 3.npm 打包 4.找到打包后的dist文件夹下面的index.html文件,编辑状态打开 找到head标签 新增<meta base="/test/">标签 5.修改dist文件夹名称为test,与nginx名称保持一致 6.修改nginx配置 新增location 指定路径名 重启nginx服务。发版成功!

FeignClient和nginx配置【代码】【图】

FeignClient 使用: 需求:现有系统A,B 需要请求到这两个系统的接口 系统A接口:系统B接口:系统B 配置文件: 调用示例:拦截器:系统A为get请求 再看看get 调用:调用成功: 总结下, FeignClient 调用 使用name 也好value 也好,都可以,甚至可以使用注册到consul中的服务名称直接调用。 只需要传参和返回值保持和生产者(提供接口的系统) 一样,就可以正常访问了。直接启动nginx就可以了

Nginx 配置高可用的集群【代码】【图】

什么是Nginx高可用 准备工作 (1)需要两台 nginx 服务器 (2)需要 keepalived (3)需要虚拟 ip配置高可用的准备工作 (1)需要两台服务器 192.168.17.129 和 192.168.17.131 (2)在两台服务器安装 nginx (3)在两台服务器安装 keepalived在两台服务器安装 keepalived (1)使用 yum 命令进行安装 yum install keepalived –y (2)安装之后,在 etc 里面生成目录 keepalived,有文件 keepalived.conf 4. 完成高可用配置(主...

Nginx 配置学习【代码】

努力奔跑只为追上那个被寄予厚望的自己。Nginx 整体配置 daemon off; worker_processes 4; pid /var/run/nginx.pid; worker_rlimit_nofile 65535;Nginx events配置示例 events {use epoll;accept_mutex off;multi_accept off;worker_connections 65535; }daemon off Docker 容器启动时,默认会把容器内部第一个进程,也就是pid=1的程序,作为docker容器是否正在运行的依据,如果 docker 容器pid=1的进程挂了,那么docker容器便会直...

腾讯云nginx配置ssl证书实现https【代码】【图】

1、申请证书2、下载证书 签发后里面包含nginx1. 1_域名_bundle.crt2. 2_域名.key 3、配置nginx文件 在配置ssl证书之前,要确保你的nginx已经安装了ssl模块,如果没有请安装。 >sbin/nginx -V nginx version: openresty/1.19.3.1 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: --prefix=/usr/local/openresty/nginx --with-cc...

windows下nginx的配置【代码】

#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" '...

nginx配置location总结及rewrite规则写法 (若配置reload或restart不生效就stop start)

location正则写法 一个示例: location = / { # 精确匹配 / ,主机名后面不能带任何字符串 [ configuration A ] } location / { # 因为所有的地址都以 / 开头,所以这条规则将匹配到所有请求 # 但是正则和最长字符串会优先匹配 [ configuration B ] } location /documents/ { # 匹配任何以 /documents/ 开头的地址,匹配符合以后,还要继续往下搜索 # 只有后面的正则表达式没有匹配到时,这一条才会采用这一条 [ configuration C ]...

nginx配置来获取用户真实IP(实测有效)【代码】

1 前言 nginx配置,网上资料各种各样,看得头晕,有时还无效。记录使用。 2 配置 编辑/etc/nginx/nginx.conf 新增代码如下:http {### Basic Settings###获取真实ip proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Real-Port $remote_port;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;sendfile on;tcp_nopush on; .... }详细如下:user root; worker_processes...

nginx配置ssl证书【代码】

server {listen 80;server_name zhj.bjedu.com;rewrite ^/(.*) https://zhj.bjedu.com/$1 permanent;}server {listen 443 ssl;server_name zhj.bjedu.com;#设置长连接keepalive_timeout 70;ssl_certificate /usr/local/nginx/cert/zhj.pem;ssl_certificate_key /usr/local/nginx/cert/zhj.key;ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_ciphers HIGH:!aNULL:!MD5;server_tokens off;

Laravel nginx配置【代码】

server {listen 82;server_name localhost2;root "G:/2.php/lishen/public";index index.php index.html index.htm;location / {try_files $uri $uri/ /index.php?$query_string;}location ~ \.php(.*)$ {fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;fastcgi_param PATH_INFO $fast...

Nginx配置Https 443 端口【代码】【图】

2021-02-22 今天有个需求,配置微信小程序接口需要的程序,那么会用到 Https 443 端口。 1、因为我用的是阿里云服务器和阿里云的域名,所以我们下面生成证书这些,都是阿里云截图。 [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Z5m8eukp-1613980270890)(https://upload-images.jianshu.io/upload_images/25699315-a3e03c07215f622c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)] 在控制台...

「Nginx」- 配置基本认证(Basic Authentication) @20210217【代码】

问题描述 配置 Nginx 基础认证(Basic Authentication),实现在访问站点时提示用户进行基础认证。 解决方法 第一步、添加用户// 创建新的 .htpasswd 文件# htpasswd -c /etc/apache2/.htpasswd "tom" New password: Re-type new password: Adding password for user tom// 追加用户到 .htpasswd 文件# htpasswd /etc/apache2/.htpasswd "cat" New password: Re-type new password: Adding password for user cat// 验证添加成功# ...

nginx配置

worker_processes 1 worker进程数 worker_priority -15 worker进程nice优先级 -20-19,数字越小亲和度越差,占用的时间片越长,可以通过top命令看到 worker_cpu_affinity 该参数可以充分利用多核cpu,使得同一个进程可以始终运行在一个固定的cpu中,从而利用该cpu中的缓存数据进行高效访问 worker_cpu_affinity auto 自动绑定cpu跟进程的关系

nginx 配置https【代码】

#配置1http跳转https配置 server {listen 80;server_name xxx.com;#域名rewrite ^(.*)$ https://$host$1 permanent; }#配置2https 443端口 server {#listen 80;#去掉#号开启同时监听HTTP和HTTPS,根据访问协议自动调整(去掉配置1)listen 443 ssl;server_name xxx.com;#域名root /project;#项目目录#注意这里没有 ssl onssl_certificate /xxx.pem; # 指定证书的位置,绝对路径ssl_certificate_key /xxx.key;...

nginx配置测试正则获取对应的值【代码】

访问会以下载文件的方式将获取到的值保存在文件中upstream docker_2 {server 10.17.172.244:8080; }server {listen 81;server_name localhost;access_log /var/log/nginx/mytest_acc.log;error_log /var/log/nginx/mytest_error.log;location ^~/ {if ($args ~* "(.*)sid=(\d+)(.*)$") {set $id $2;}echo $id;} }