GithubHelp home page GithubHelp logo

Comments (11)

YI-- avatar YI-- commented on August 23, 2024

外部nginx以及反向代理:

server
{
    listen 80;
	listen 443 ssl http2;
    server_name xxxx;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/xxx;
    
    #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
    #error_page 404/404.html;
    #HTTP_TO_HTTPS_START
    if ($server_port !~ 443){
        rewrite ^(/.*)$ https://$host$1 permanent;
    }
    #HTTP_TO_HTTPS_END
    ssl_certificate    /www/server/panel/vhost/cert/xxx/fullchain.pem;
    ssl_certificate_key    /www/server/panel/vhost/cert/xxx/privkey.pem;
    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    add_header Strict-Transport-Security "max-age=31536000";
    error_page 497  https://$host$request_uri;



    #SSL-END
    
    #ERROR-PAGE-START  错误页配置,可以注释、删除或修改
    #error_page 404 /404.html;
    #error_page 502 /502.html;
    #ERROR-PAGE-END
    
    #PHP-INFO-START  PHP引用配置,可以注释或修改
    #清理缓存规则

    location ~ /purge(/.*) {
        proxy_cache_purge cache_one $host$1$is_args$args;
        #access_log  /www/wwwlogs/xxx_purge_cache.log;
    }
	#引用反向代理规则,注释后配置的反向代理将无效
	include /www/server/panel/vhost/nginx/proxy/xxx/*.conf;

	include enable-php-00.conf;
    #PHP-INFO-END
    
    #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
    include /www/server/panel/vhost/rewrite/xxx.conf;
    #REWRITE-END
    
    #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }
    
    #一键申请SSL证书验证目录相关设置
    location ~ \.well-known{
        allow all;
    }
    
    access_log  /www/wwwlogs/xxx.log;
    error_log  /www/wwwlogs/xxx.error.log;
}

反向代理:

#PROXY-START/
location  ~* \.(gif|png|jpg|css|js|woff|woff2)$
{
    proxy_pass http://127.0.0.1:3010;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    expires 12h;
}
location /
{
    proxy_pass http://127.0.0.1:3010;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    
    add_header X-Cache $upstream_cache_status;
    
    #Set Nginx Cache
    
    	add_header Cache-Control no-cache;
}

#PROXY-END/

安装方式为:

docker run --name app_host -p 3000:3010 -d tinyc/app-host:lastest

from app-host.

tinyc-z avatar tinyc-z commented on August 23, 2024

直接访问3000的资源会404吗?

from app-host.

YI-- avatar YI-- commented on August 23, 2024

直接访问3000的资源会404吗?

目前我3000端口是被其他Docker项目占用的,我把占用的容器临时关闭之后,直接3000端口访问资源是不通的,也就是现在app-host是不占用3000端口的。

from app-host.

YI-- avatar YI-- commented on August 23, 2024

我刚刚用

docker run --name app_host -p 3000:3000 -d tinyc/app-host:lastest

docker run --name app_host -p 3000:8686 -d tinyc/app-host:lastest

这两个安装试了,以及不同的版本如 dev0.2.4, 0.2.3等,还是同样的问题,

from app-host.

tinyc-z avatar tinyc-z commented on August 23, 2024

进到 ng 里面看下 log 调试?看样子应该没问题才对

from app-host.

tinyc-z avatar tinyc-z commented on August 23, 2024

docker run --name app_host -p 3000:8686 -d tinyc/app-host:lastest 应该是可以的3000:3000 肯定不行

from app-host.

YI-- avatar YI-- commented on August 23, 2024

进到 ng 里面看下 log 调试?看样子应该没问题才对

我nginx错误日志有这几个关键信息:

11月01日的

2021/11/01 22:31:27 [error] 7964#0: *6048610 open() "/www/wwwroot/xxx.xxx.xxx/assets/application-1b7c2119d0cc0be69a0e6705ee19d5bf859cc64e949a0faf412286a8a53db169.js" failed (2: No such file or directory), client: 103.97.201.53, server: xxx.xxx.xxx, request: "GET /assets/application-1b7c2119d0cc0be69a0e6705ee19d5bf859cc64e949a0faf412286a8a53db169.js HTTP/2.0", host: "xxx.xxx.xxx", referrer: "https://xxx.xxx.xxxt/"
2021/11/01 23:01:10 [error] 7964#0: *6050316 open() "/www/wwwroot/xxx.xxx.xxx/assets/application-41af77abe951a130d440634e9418ca6610bb573cd08db59dd0c453025aac2b06.css" failed (2: No such file or directory), client: 103.97.201.53, server: xxx.xxx.xxx, request: "GET /assets/application-41af77abe951a130d440634e9418ca6610bb573cd08db59dd0c453025aac2b06.css HTTP/2.0", host: "xxx.xxx.xxx", referrer: "https://xxx.xxx.xxx/"
2021/11/01 23:01:10 [error] 7964#0: *6050316 open() "/www/wwwroot/xxx.xxx.xxx/assets/application-1b7c2119d0cc0be69a0e6705ee19d5bf859cc64e949a0faf412286a8a53db169.js" failed (2: No such file or directory), client: 103.97.201.53, server: xxx.xxx.xxx, request: "GET /assets/application-1b7c2119d0cc0be69a0e6705ee19d5bf859cc64e949a0faf412286a8a53db169.js HTTP/2.0", host: "xxx.xxx.xxx", referrer: "https://xxx.xxx.xxx/"

11月03日的,只有这几条,之后就没有了

2021/11/03 09:57:21 [error] 10835#0: *6171415 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 27.19.232.137, server: xxx.xxx.xxx, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:3010/", host: "xxx.xxx.xxx"
2021/11/03 23:48:41 [error] 10835#0: *6218159 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 103.97.201.53, server: xxx.xxx.xxx, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:3010/", host: "xxx.xxx.xxx"
2021/11/03 23:48:42 [error] 10835#0: *6218159 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 103.97.201.53, server: xxx.xxx.xxx, request: "GET /favicon.ico HTTP/2.0", upstream: "http://127.0.0.1:3010/favicon.ico", host: "xxx.xxx.xxx", referrer: "https://xxx.xxx.xxx/"

这是在11月03日的nginx error 期间的访问日志

103.97.201.53 - - [03/Nov/2021:23:48:41 +0800] "GET / HTTP/2.0" 502 150 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:48:42 +0800] "GET /favicon.ico HTTP/2.0" 499 0 "https://xxx.xxx.xxx/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:48:45 +0800] "GET / HTTP/2.0" 200 901 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:48:45 +0800] "GET /assets/application-1b7c2119d0cc0be69a0e6705ee19d5bf859cc64e949a0faf412286a8a53db169.js HTTP/2.0" 404 730 "https://xxx.xxx.xxx/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:48:45 +0800] "GET /assets/application-41af77abe951a130d440634e9418ca6610bb573cd08db59dd0c453025aac2b06.css HTTP/2.0" 404 730 "https://xxx.xxx.xxx/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:48:47 +0800] "GET / HTTP/2.0" 200 898 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:48:47 +0800] "GET /assets/application-1b7c2119d0cc0be69a0e6705ee19d5bf859cc64e949a0faf412286a8a53db169.js HTTP/2.0" 404 730 "https://xxx.xxx.xxx/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:48:47 +0800] "GET /assets/application-41af77abe951a130d440634e9418ca6610bb573cd08db59dd0c453025aac2b06.css HTTP/2.0" 404 730 "https://xxx.xxx.xxx/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:48:49 +0800] "GET / HTTP/2.0" 200 898 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:48:50 +0800] "GET /assets/application-1b7c2119d0cc0be69a0e6705ee19d5bf859cc64e949a0faf412286a8a53db169.js HTTP/2.0" 404 730 "https://xxx.xxx.xxx/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:48:50 +0800] "GET /assets/application-41af77abe951a130d440634e9418ca6610bb573cd08db59dd0c453025aac2b06.css HTTP/2.0" 404 730 "https://xxx.xxx.xxx/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:48:52 +0800] "GET / HTTP/2.0" 200 898 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:49:11 +0800] "GET / HTTP/2.0" 200 900 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:49:11 +0800] "GET /assets/application-41af77abe951a130d440634e9418ca6610bb573cd08db59dd0c453025aac2b06.css HTTP/2.0" 404 730 "https://xxx.xxx.xxx/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:49:11 +0800] "GET /assets/application-1b7c2119d0cc0be69a0e6705ee19d5bf859cc64e949a0faf412286a8a53db169.js HTTP/2.0" 404 730 "https://xxx.xxx.xxx/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:59:07 +0800] "GET / HTTP/2.0" 200 896 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:59:07 +0800] "GET /assets/application-41af77abe951a130d440634e9418ca6610bb573cd08db59dd0c453025aac2b06.css HTTP/2.0" 404 730 "https://xxx.xxx.xxx/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:59:07 +0800] "GET /assets/application-1b7c2119d0cc0be69a0e6705ee19d5bf859cc64e949a0faf412286a8a53db169.js HTTP/2.0" 404 730 "https://xxx.xxx.xxx/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"
103.97.201.53 - - [03/Nov/2021:23:59:08 +0800] "GET /favicon.ico HTTP/2.0" 404 0 "https://xxx.xxx.xxx/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0"

这个日志我还真看不出来有什么问题,之后我用 用法 3 源码运行 试下

from app-host.

tinyc-z avatar tinyc-z commented on August 23, 2024

2021/11/01 22:31:27 [error] 7964#0: *6048610 open() "/www/wwwroot/xxx.xxx.xxx/assets/application-1b7c2119d0cc0be69a0e6705ee19d5bf859cc64e949a0faf412286a8a53db169.js" failed (2: No such file or directory), client: 103.97.201.53, server: xxx.xxx.xxx, request: "GET /assets/application-1b7c2119d0cc0be69a0e6705ee19d5bf859cc64e949a0faf412286a8a53db169.js HTTP/2.0", host: "xxx.xxx.xxx", referrer: "https://xxx.xxx.xxxt/"

例如这条 log,看样子 地址就不对吧。你看下你这个 /www/wwwroot/xxx.xxx.xxx/assets 文件夹,都不是到 app 目录下的,应该在: 项目/public/assets/xxxx.js

from app-host.

tinyc-z avatar tinyc-z commented on August 23, 2024

要不你简单点,先用 docker 的方式,先把你之前的老数据上了,重新 run 一次
docker run --name app_host -p 3000:8686 -d tinyc/app-host:lastest
然后浏览器访问 http://localhost:3000

from app-host.

YI-- avatar YI-- commented on August 23, 2024

2021/11/01 22:31:27 [error] 7964#0: *6048610 open() "/www/wwwroot/xxx.xxx.xxx/assets/application-1b7c2119d0cc0be69a0e6705ee19d5bf859cc64e949a0faf412286a8a53db169.js" failed (2: No such file or directory), client: 103.97.201.53, server: xxx.xxx.xxx, request: "GET /assets/application-1b7c2119d0cc0be69a0e6705ee19d5bf859cc64e949a0faf412286a8a53db169.js HTTP/2.0", host: "xxx.xxx.xxx", referrer: "https://xxx.xxx.xxxt/"

例如这条 log,看样子 地址就不对吧。你看下你这个 /www/wwwroot/xxx.xxx.xxx/assets 文件夹,都不是到 app 目录下的,应该在: 项目/public/assets/xxxx.js

这个地址是 是Nginx反向代理所在的目录,是一个没有内容的静态网站。反向代理没有代理过去?

我把所有容器都停了,然后

docker run --name app_host -p 3000:8686 -d tinyc/app-host:lastest

这个时候通过IP:3000 是可以正确访问的

from app-host.

YI-- avatar YI-- commented on August 23, 2024

要不你简单点,先用 docker 的方式,先把你之前的老数据上了,重新 run 一次 docker run --name app_host -p 3000:8686 -d tinyc/app-host:lastest 然后浏览器访问 http://localhost:3000

这个包只要修改端口,始终还是会自动去访问IP:3000 端口

如:
docker run --name app_host3 -p 3011:8686 -d tinyc/app-host:lastest
docker run --name app_host3 -p 3333:8686 -d tinyc/app-host:lastest

这种通过IP:3011访问,始终都会自动302至:IP:3000

from app-host.

Related Issues (20)

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.