Skip to content

Commit

Permalink
feat: 调整前缀
Browse files Browse the repository at this point in the history
  • Loading branch information
lkzc19 committed Jul 15, 2024
1 parent 5745ee3 commit cf4331e
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 6 deletions.
2 changes: 1 addition & 1 deletion v-demo/shortlink/shortlink-spring/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ COPY ./build/libs/shortlink-0.0.1-SNAPSHOT.jar app.jar

EXPOSE 3000

ENTRYPOINT ["java", "-jar", "app.jar"]
ENTRYPOINT ["java", "-Dspring.profiles.active=prod", "-jar", "app.jar"]
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.google.zxing.client.j2se.MatrixToImageWriter
import com.google.zxing.qrcode.QRCodeWriter
import org.example.LinkMap
import org.example.base62Map
import org.springframework.beans.factory.annotation.Value
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
Expand All @@ -21,7 +22,8 @@ import kotlin.io.encoding.ExperimentalEncodingApi
class ShortlinkController {

val hashUtils = MurmurHash3()
val prefix = "http://localhost:3000/"
@Value("\${vitamin.prefix}")
lateinit var prefix: String

@OptIn(ExperimentalEncodingApi::class)
@GetMapping("/")
Expand Down Expand Up @@ -74,6 +76,6 @@ class ShortlinkController {

@GetMapping("/ping")
fun ping(): String {
return "pong..."
return "pong...$prefix"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
server:
port: 3000

vitamin:
prefix: http://localhost:3000/
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
server:
port: 3000

vitamin:
prefix: https://drinkice.xyz/

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
spring:
application:
name: shortlink
profiles:
active: dev

vitamin:
perfix: http://localhost:3000/
48 changes: 48 additions & 0 deletions v-ops/ops-nginx/archives/nl.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
charset utf-8; # 避免中文乱码

autoindex on; #开启索引功能
autoindex_exact_size off; #关闭计算文件确切大小(单位bytes),只显示大概大小(单位kb、mb、gb)
autoindex_localtime on; #显示本机时间而非 GMT 时间


server {
listen 80;
server_name nahidalibrary.xyz;

location /nlib/ {
alias /nahida-library/nlib/;
}

location /api/ {
proxy_pass http://0.0.0.0:9100/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

upstream nacos-cluster {
server nacos01:9848;
}

server {
listen 9848;
server_name nacos01;

location /nacos {
proxy_pass http://nacos-cluster/nacos;
}
}

server {
listen 9900;
server_name webhook;

location ~ ^/webhook/(.*)$ {
proxy_pass http://0.0.0.0:9000/hooks/$1;
}
}
33 changes: 33 additions & 0 deletions v-ops/ops-nginx/archives/ssl.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
server {
listen 443 ssl;
server_name drinkice.xyz;

# 设置ssl证书文件路径
ssl_certificate certs/drinkice.xyz.pem;
ssl_certificate_key certs/drinkice.xyz.key;

ssl_session_timeout 5m;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security "max-age=31536000";

# 访问日志
access_log /var/log/nginx/drinkice.xyz.https.log;


location /file/ {
alias /nahida-library/nlib/;
}

location / {
proxy_pass http://0.0.0.0:9876/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

0 comments on commit cf4331e

Please sign in to comment.