Git Product home page Git Product logo

myurls's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

myurls's Issues

docker 部署失败

[root@mervyn MyUrls]# docker-compose up -d
[+] Building 136.5s (7/13)                                                                                                                                                                                                                                                    
 => [internal] load .dockerignore                                                                                                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                          0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                     0.0s
 => => transferring dockerfile: 389B                                                                                                                                                                                                                                     0.0s
 => [internal] load metadata for docker.io/library/golang:1.20-alpine                                                                                                                                                                                                   15.8s
 => CACHED [build 1/6] FROM docker.io/library/golang:1.20-alpine@sha256:fd9d9d7194ec40a9a6ae89fcaef3e47c47de7746dd5848ab5343695dbbd09f8c                                                                                                                                 0.0s
 => [internal] load build context                                                                                                                                                                                                                                        0.0s
 => => transferring context: 33.62kB                                                                                                                                                                                                                                     0.0s
 => CACHED [stage-1 1/3] WORKDIR /app                                                                                                                                                                                                                                    0.0s
 => ERROR [build 2/6] RUN apk update && apk add upx                                                                                                                                                                                                                    120.6s
------                                                                                                                                                                                                                                                                        
 > [build 2/6] RUN apk update && apk add upx:                                                                                                                                                                                                                                 
#0 0.215 fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz                                                                                                                                                                                        
#0 60.38 WARNING: updating and opening https://dl-cdn.alpinelinux.org/alpine/v3.18/main: Permission denied                                                                                                                                                                    
#0 60.38 fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/x86_64/APKINDEX.tar.gz
#0 120.5 WARNING: updating and opening https://dl-cdn.alpinelinux.org/alpine/v3.18/community: Permission denied
#0 120.5 4 unavailable, 0 stale; 16 distinct packages available
------
failed to solve: process "/bin/sh -c apk update && apk add upx" did not complete successfully: exit code: 4

docker版本

[root@mervyn MyUrls]# docker -v
Docker version 24.0.2, build cb74dfc

已经配置了正确的跨域,浏览器F12看还是报错

          @cs-star Access to XMLHttpRequest at 'https://zz01.ml/short' from origin 'https://sub.aa01.ml' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

反代未正确配置跨域

Originally posted by @CareyWang in #20 (comment)

65e08baaf376318d4c9a989dea010500
1695649276533


找到原因了,sub-web短链接API后面一定要加上/short!!!!

如何将MyUrls接入sub-web

我已经在.vue文件里添加了 我的域名/short 但是在前端调用的时候,还是会显示短链接获取失败,短链接单独使用是没问题的

跨域

各位,如果你们域名是托管到cf上的话,在本地配置跨域是没用的
可以去cf上的转换规则上配置
亲自踩坑!!!
有用记得回来赞我

跨域问题如何解决?

您好Carey,
在配置了一上午这个MyUrls之后我发现还是无法运行,subweb始终报错跨域有问题,我是宝塔面板安装的redis,php也安装了redis插件,redis-cli正常运行,后端地址配置无误,所有文件使用最新master。

跨域问题我在短链接反向代理配置文件中加入了

add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;

始终无效,后续换了很多也持续报错,请问这个跨域该怎么配置才是正确的呢?

docker版布署出错,大佬帮看看是什么问题

Status: Downloaded newer image for golang:1.20-alpine
---> 818ca3531f99
Step 2/13 : WORKDIR /app
---> Running in c44166717085
Removing intermediate container c44166717085
---> df3135846e2a
Step 3/13 : COPY main.go go.mod go.sum .
When using COPY with more than one source file, the destination must be a directory and end with a /
ERROR: Service 'myurls' failed to build

longUrl is empty

服务端返回下面的数据

{
    "Code": 1,
    "Message": "longUrl为空",
    "LongUrl": "",
    "ShortUrl": ""
}

但是请求参数中提交了longUrl,下面是日志:

[GIN] 2020/04/21 - 04:48:50 | 400 |      79.993µs |      172.17.0.1 | POST     "/short?longUrl=aHR0cHM6Ly93d3cueW91dHViZS5jb20v"

请问这个怎么解决?

Easier Installation

Hello there!
I hope you're doing great!

I was wondering if you could provide an easier installation, so that everyone could have this link shortner.
As of now, it's too complicated to be honest.

Please let me know,
Thanks a lot!

希望增加ARM64支持

Carey您好~

最近我购买了树莓派4B,然后在考虑把公网服务器的服务迁移到树莓派上,这个短链服务我一直觉得很喜欢所以也想迁移过来,但是并没有ARM64的支持,所以想问一下有任何支持ARM64的计划吗?

构建docker编译出错

修改index.html之后,重新构建镜像出错,应该是go编译的时候有问题

Status: Downloaded newer image for golang:1.19-alpine
---> feb4bbda921c
Step 2/15 : WORKDIR /app
---> Running in 66c72d90d14b
Removing intermediate container 66c72d90d14b
---> e8edd07e9474
Step 3/15 : RUN go env -w GO111MODULE="on" && go env -w GOPROXY="https://goproxy.cn,direct"
---> Running in 245e10d4448c
Removing intermediate container 245e10d4448c
---> 0cc71ab9e924
Step 4/15 : COPY go.sum go.mod ./
---> 91c8cb9c3f17
Step 5/15 : RUN go mod tidy
---> Running in 3d6300222a0c
go: warning: "all" matched no packages
Removing intermediate container 3d6300222a0c
---> 60d212c5c04d
Step 6/15 : FROM dependencies as build
---> 60d212c5c04d
Step 7/15 : WORKDIR /app
---> Running in 8e5ec242fef2
Removing intermediate container 8e5ec242fef2
---> 401364df6317
Step 8/15 : COPY main.go ./
---> 64424ec478b5
Step 9/15 : RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o myurls main.go
---> Running in 197b4d1483b0
main.go:14:2: no required module provides package github.com/gin-gonic/gin; to add it:
go get github.com/gin-gonic/gin
main.go:15:2: no required module provides package github.com/gomodule/redigo/redis; to add it:
go get github.com/gomodule/redigo/redis
main.go:16:2: no required module provides package github.com/sirupsen/logrus; to add it:
go get github.com/sirupsen/logrus
The command '/bin/sh -c CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o myurls main.go' returned a non-zero code: 1

到这里就出错了,大佬帮忙看看。docker-compose 一样的问题

debain11

总是获取短链接失败

docker-compose 安装Myurls

ili.llc:8002

总是提示获取短链接失败。

image

image

image

麻烦了,请指点一下是哪里的问题

大佬,新版本后,前端的页面部署了打不开

和之前版本一样反代,,权限、内存空间都没问题,但还是直接返回502
服务器内curl也是502
部署方式docker-compose
这次没有修改index.html,也没有修改docker-compose
仅仅修改了env文件

MYURLS_PORT=9002
MYURLS_DOMAIN=s2.sky11111.com
MYURLS_PROTO=https

求救啊……

大大求救啊!!!docker使用时出现了无法连接redis的问题

两天了一直没解决这个问题……快崩溃了

问题描述:
后台curl -i http://s2*/short和curl -i http://127.0.0.1/short
均会在等待十几秒后返回 短链接不存在或已过期
redis中无新的key增加
docker logs myurls会提示

[GIN] 2023/07/23 - 03:57:52 | 200 |    1.277873ms |   194.29.187.* | GET      "/"
[GIN] 2023/07/23 - 03:58:14 | 200 | 30.015488771s |   194.29.187.* | POST     "/short"
[GIN] 2023/07/23 - 03:58:18 | 200 |     161.564µs |   194.29.187.* | GET      "/"
[GIN] 2023/07/23 - 03:58:26 | 200 | 30.003869954s |   194.29.187.* | POST     "/short"
[GIN] 2023/07/23 - 03:58:51 | 200 | 30.022925521s |   194.29.187.* | POST     "/short"
[GIN] 2023/07/23 - 04:05:18 | 404 | 30.029518236s |  95.214.1**.* | GET      "/short"
[GIN] 2023/07/23 - 04:06:00 | 404 | 30.029486231s |      172.22.0.1 | GET      "/short"

感觉哪里出了问题,myurls没能成功访问redis

补充一点,直接使用默认的docker compose也会有类似的问题……

配置如下:

env文件

MYURLS_PORT=9002
MYURLS_DOMAIN=*
MYURLS_TTL=180

index.html

const backend = 'https://*' 这里无论http还是https都会出现问题

docker compose
对这个配置稍微进行了修改
手动redis-cli -h 127.0.0.1 -p 9003访问redis正常

version: "3"
services:
  myurls:
    build: .
    container_name: myurls
    restart: always
    env_file: .env
    ports:
      - "${MYURLS_PORT}:8002"
    volumes:
      - ./data/myurls/logs:/app/logs
    depends_on:
      - myurls-redis
    entrypoint: ["/app/myurls", "-domain", "${MYURLS_DOMAIN}", "-conn", "myurls-redis:6379", "-passwd", "123123", "-ttl", "${MYURLS_TTL}"]
    command: redis-server --requirepass fdsaf342

  myurls-redis:
    image: "redis:6"
    container_name: myurls-redis
    restart: always
    volumes:
      - ./data/redis:/data
    expose:
      - "6379"
    ports:
      - 9003:6379
    command: redis-server --requirepass 123123

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.