当前位置: 首页 > news >正文

一个网站可以同时几个主域名吗图片制作的软件有哪些

一个网站可以同时几个主域名吗,图片制作的软件有哪些,国内电商推广,北京手机网站制作公司文章目录 1、使用Nginx增加认证。2、使用Spring Gateway增加认证 SkyWalking的可视化后台是没有用户认证功能的,默认下所有知道地址的用户都能访问,官网是建议通过网关增加认证。 本文介绍通过Nginx和Spring Gateway两种方式 1、使用Nginx增加认证。 生…

文章目录

    • 1、使用Nginx增加认证。
    • 2、使用Spring Gateway增加认证

SkyWalking的可视化后台是没有用户认证功能的,默认下所有知道地址的用户都能访问,官网是建议通过网关增加认证。
本文介绍通过Nginx和Spring Gateway两种方式

1、使用Nginx增加认证。

生成密钥

yum install -y httpd-tools
htpasswd -cb nginx/htpasswd skywalking rtgdbhyffddu#

配置nginx

worker_processes 1;
error_log stderr notice;
events {worker_connections 1024;
}
http {variables_hash_max_size 1024;access_log off;#ireal_ip_header X-Real-IP;charset utf-8;server {listen 8081;#auth_basic "Please enter the user name and password"; #这里是验证时的提示信息#auth_basic_user_file /data/skywalking/nginx/htpasswd;index  index.html;location / {root   html;index  index.html index.htm;#auth_basic on;auth_basic "Please enter the user name and password"; #这里是验证时的提示信息auth_basic_user_file /etc/nginx/htpasswd;proxy_pass http://172.17.0.9:8080;# WebSocket 穿透#proxy_set_header Origin "";#proxy_set_header Upgrade $http_upgrade;#proxy_set_header Connection "upgrade";}}
}

密码配置:/etc/nginx/htpasswd

skywalking:$apr1$FVaUB8RE$.brXLk5N.IsNRqm3.Vy2n1

在这里插入图片描述
在这里插入图片描述

2、使用Spring Gateway增加认证

主要是使用Spring Gateway和Spring Security的基础认证formLogin实现,
pom.xml使用的依赖包

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.penngo.web.gateway</groupId><artifactId>web_gateway</artifactId><version>1.0.0</version><properties><maven.compiler.source>17</maven.compiler.source><maven.compiler.target>17</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-gateway</artifactId></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-loadbalancer</artifactId></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-bootstrap</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-security</artifactId></dependency></dependencies><dependencyManagement><dependencies><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>2022.0.4</version><type>pom</type><scope>import</scope></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-dependencies</artifactId><version>3.1.0</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><configuration><mainClass>com.penngo.web.gateway.WebGatewayMain</mainClass><excludes><exclude><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></exclude></excludes></configuration></plugin></plugins></build></project>

WebGatewayMain.java

package com.penngo.web.gateway;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication
public class WebGatewayMain {public static void main(String[] args) {SpringApplication.run(WebGatewayMain.class, args);}
}

SecurityConfiguration.java配置

package com.penngo.web.gateway;import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.core.userdetails.MapReactiveUserDetailsService;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.server.SecurityWebFilterChain;import static org.springframework.security.config.Customizer.withDefaults;@EnableWebFluxSecurity
@Configuration
public class SecurityConfiguration {@BeanSecurityWebFilterChain springWebFilterChain(ServerHttpSecurity http) {http.authorizeExchange((authorize) -> authorize.anyExchange().authenticated()).cors(cors->cors.disable()).csrf(csrf->csrf.disable()).formLogin(withDefaults());return http.build();}/*** 可以在代码中配置密码,也可以在application.xml中配置密码* @return*/
//    @Bean
//    MapReactiveUserDetailsService userDetailsService() {
//
//        UserDetails user = User.withDefaultPasswordEncoder()
//                .username("admin")
//                .password("123456")
//                .roles("USER")
//                .build();
//        return new MapReactiveUserDetailsService(user);
//    }
}

application.yml

server:port: 8081servlet:encoding:force: truecharset: UTF-8enabled: true
spring:application:name: gatewayappsecurity:user:name: admin2password: 123456

bootstrap.yml

spring:cloud:gateway:routes:- id: skywalkinguri: http://localhost:8080/# 绑定ip白名单predicates:- RemoteAddr=127.0.0.1/32,192.168.245.65/32

运行效果
在这里插入图片描述
在这里插入图片描述

http://www.yayakq.cn/news/931397/

相关文章:

  • 云南省城乡和住房建设厅网站银川森淼生态园
  • 绝唯cms网站管理系统青岛 公司 网站建设价格
  • 制作网站站用的软件wordpress文章背景颜色
  • 网站对接如何做html中文网站模板
  • 免费图片编辑网站做it的要给赌场网站做维护吗
  • 微信公众号的h5网站开发6什么叫做响应式网站
  • mysql的网站开发长沙 网站建设公司
  • 如何做网站微信支付mysql开发网站开发
  • 动漫网站设计源代码上海网站建设百度推广公司哪家好
  • 爱站网关键词挖掘查询wordpress相册灯箱
  • 网站建设科办公室设计报价
  • 做的网站怎么让百度收录腾讯云镜像安装wordpress
  • 云南网站制作价格动态静态结合网站
  • python做网站的实例网站建设团队管理模板
  • 建设网站的企业专业服务上海广告公司排行榜
  • 济南网站设计建设西安网上注册公司流程
  • 简述电子商务网站建设的基本要求河南省交通工程造价信息网
  • 国外调色教程网站网站建设重点步骤
  • 上海专业做网站电话微平台推广
  • 菜单设计制作图片网站专题优化
  • 做视频网站成本高吗免费咨询平台
  • 企业建站设计喜来健cms系统
  • 已经有了域名怎么做网站开发软件系统
  • 教育类网站素材wordpress外网
  • 海尔商城网站建设维护陕西省建设银行网站6
  • 南山网站设计公司企业地址如何地图添加
  • 高端网站定制策划龙岗做棋牌网站建设
  • 做一个外贸网站wordpress分类设计
  • 网站开发的功能需求和模块划分移动网站设计
  • 学而思编程网站wordpress 如何升级