首页 > 系统相关 >NGINX配置记录

NGINX配置记录

时间:2024-05-08 17:23:01浏览次数:25  
标签:Control header 配置 Access NGINX add location 记录 proxy

#### NGINX配置记录

server {
  listen 80;
  server_name www.222.com;
  charset utf-8;
  #root html/222/wap/dist;
  # location /robots.txt {
  

  # 301 重定向
  #return 301 http://www.333.com;

  if ($time_iso8601 ~ "(\d{4})-(\d{2})-(\d{2})") {
    # set $day $1$2$3;
    set $day $1$2;
  }


  access_log /usr/local/222/nginx/logs/client_access_$day.log combined;


  location /ch {
    try_files $uri $uri/ /ch/index.html;
  }
  location / {
    add_header Access-Control-Allow-Origin '*';
    add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
    add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
    proxy_set_header Host $http_host;
    proxy_pass http://localhost:8969;
  }

  location /mobile {
    proxy_set_header x-real-ip $remote_addr;
    add_header Access-Control-Allow-Origin '*';
    add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
    add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
    proxy_pass http://localhost:8999;
  }


  location ^~ /cmsApi/ {
    proxy_pass https://cms.111.com;
  }
}

server {
  listen 443;
  server_name www.22.com;
  # 301 重定向
  #return 301 https://www.3333.com;
  if ($time_iso8601 ~ "(\d{4})-(\d{2})-(\d{2})") {
    set $day $1$2;
  }


  access_log /usr/local/222/nginx/logs/client_access_$day.log combined;

  ssl on;
  ssl_stapling on;
  ssl_stapling_verify on;
  resolver 8.8.4.4 8.8.8.8;
  ssl_certificate cert/22/22.com.crt;
  ssl_certificate_key cert/22/22.com.key;
  ssl_session_cache shared:SSL:1m;
  ssl_session_timeout 5m;
  ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_prefer_server_ciphers on;

  root html/22/wap/dist;

  location /robots.txt {
    return 200 "User-agent: JikeSpider\nDisallow: /\n\nUser-agent: YYSpider\nDisallow: /\n\nUser-agent: *\nDisallow: /*?*\nDisallow: /user\nDisallow: /login\nDisallow: /cmsApi\nDisallow: /_nuxt\nDisallow: /card*\nDisallow: /goods/detail/undefined*\nDisallow: /landing\n\nSitemap: https://www.kongfuka.com/sitemap.txt";
  }
  #location /h5newsmap2.txt {
    # alias html/222/wap/dist/222.txt;
  #}


  location ^~ /priceSpider/ {
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;

  rewrite ^/priceSpider/(.*)$ /$1 break;
    proxy_pass http://localhost:3121;
  }
  location /ch {
    try_files $uri $uri/ /ch/index.html;
  }
  location / {     add_header Access-Control-Allow-Origin '*';     add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';     add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';     proxy_set_header Host $http_host;     proxy_pass http://localhost:8969;   }   location /mobile {     proxy_set_header x-real-ip $remote_addr;     add_header Access-Control-Allow-Origin '*';     add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';     add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';     proxy_pass http://localhost:8999;   }   location /activitys {     try_files $uri $uri/ /activitys/index.html;     #try_files $uri $uri/ /index.html;   }
  location ^~ /cmsApi/ {     proxy_pass https://cms.itangka.com;   } }

  

标签:Control,header,配置,Access,NGINX,add,location,记录,proxy
From: https://www.cnblogs.com/shijiaoyun/p/18180306

相关文章

  • Nginx
    Nginx是一款开源的高性能HTTP服务器和反向代理服务器,用于处理静态内容,维护持久连接,以及提供第七层负载均衡器支持。以下是Nginx的一些主要特性:静态内容服务:Nginx可以处理静态内容,如HTML,图片,CSS,JavaScript等。反向代理:Nginx可以作为代理服务器接收客户端请求,并将请求转发......
  • 在idea中配置maven环境
    在idea中配置maven环境(maven安装目录下建一个mvn_resp文件夹)  配置mvn:  ......
  • 银河麒麟V10——问题记录
    1.在桌面登录用户后无法进入桌面,又退回到登录页面。权限问题:切到后台ctrl+alt+F1,进入主目录,chown-R用户名:用户名.Xauthority如仍解决不了问题,查看~.xesession-error日志,借助日志解决问题,如出现privatesocketdirermissiondeniedchmod 777 /tmp,修改/tmp权限。2......
  • idea安装后的常用配置
    1、配置JDK2、设置编码格式3、设置字体大小4、配置GIT工具5、设置代码构建处理器堆大小6、配置MAVEN7、设置idea主题风格......
  • [转]矿卡P104再就业AI绘图(附centos安装cuda及配置stable diffusion教程)
    原文地址:矿卡P104再就业AI绘图(附centos安装cuda及配置stablediffusion教程)-哔哩哔哩早就听说p104用的gtx1080同款核心,只是阉割了编解码与视频输出,cuda还在,有8G显存,一看就很适合ai画图,当然,150不到的超低廉价格才是笔者购买它的决定性原因!    废话不多说,在linux上使用该显......
  • react ts 项目如何配置路径别名?
    tsconfig.json{"compilerOptions":{"baseUrl":".",//路径配置"paths":{"@/*":["src/*"]},"target":"ES2020","lib":[......
  • C# 相关记录
     程序转成Windows服务varoptions=newWebApplicationOptions{Args=args,ContentRootPath=WindowsServiceHelpers.IsWindowsService()?AppContext.BaseDirectory:default};varbuilder=WebApplication.CreateBuilder(options); webservices服务转成cs类......
  • conda-pip镜像源配置
    1.conda:Windows用户无法直接创建名为 .condarc 的文件,可先在AnacondaPowershell中执行 condaconfig--setshow_channel_urlsyes 生成该文件之后再修改。通过pwd查看根目录,进入根目录对.condarc 文件进行修改:文件内内容删除,然后输入channels:-defaultsshow_chann......
  • bond模式详解与配置
    1.bond介绍以太网通道绑定(EthernetChannelBonding)是一种网络技术,用于将多个物理网络接口(通常是以太网网卡)组合成一个逻辑接口。这样做的目的是增加网络带宽、提高可靠性和提供冗余备份。在以太网通道绑定中,多个物理接口被绑定在一起形成一个虚拟的接口,称为Bond接口。该Bond......
  • CF566E 做题记录
    link比较常规的一道构造题,练习自己的构造水平。首先对于一条边\((u,v)\),如果有边\((x,u),(v,y)\),我们可以对\(x,y\)的距离不超过\(2\)的点集\(S_x,S_y\)进行求交\(S_x\capS_y\),结果恰好就是\(\{u,v\}\)。我们枚举两条信息,对两个集合求交,如果结果为两个点,那么这两个......