Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows部署本地链接显示本站可用,非本地连接本站就失效了 #10

Closed
Nothingness-Void opened this issue Jul 20, 2023 · 3 comments

Comments

@Nothingness-Void
Copy link

如题,
本地连接时
image

远程连接时
image

服务是我跟linux服务器一样用caddy转成Https的

@Harry-zklcdc
Copy link
Owner

没有配置 WebSocket 转发设置,caddy 的配置我不熟悉,Nginx 我有一套配置,参考: adams549659584#282 (comment)

@Nothingness-Void
Copy link
Author

Nothingness-Void commented Jul 21, 2023

没有配置 WebSocket 转发设置,caddy 的配置我不熟悉,Nginx 我有一套配置,参考: adams549659584#282 (comment)
大佬我把配置文件加进去提示这个
nginx: [emerg] unknown "proxy_add_forwarded" variable
我问了Bing说是要改东西
image
没用过nginx没把握,还请大佬帮忙看看

配置文件如下

#user  nobody;
worker_processes  1;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    proxy_cache_path /tmp/nginx/temp/cache_one levels=1:2 keys_zone=cache_one:100m inactive=7d max_size=30g;
   
    map $http_upgrade $connection_upgrade {
      default upgrade;
        '' close;
            }


    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    server {
        listen       443 ssl;
        server_name  localhost;

        ssl_certificate      C:/Users/NothingnessVoid/Desktop/nginx-1.25.1/ai.nothingnessvoid.tech.cer;
        ssl_certificate_key  C:/Users/NothingnessVoid/Desktop/nginx-1.25.1/ai.nothingnessvoid.tech.key;

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

        location / {
		proxy_pass http://127.0.0.1:8080;
 		proxy_http_version        1.1;
 		proxy_cache_bypass     $http_upgrade;

 		# Proxy headers
 		proxy_set_header Upgrade                   $http_upgrade;
 		proxy_set_header Connection               $connection_upgrade;
 		proxy_set_header Host                          $host;
 		proxy_set_header X-Real-IP                  $remote_addr;
 		proxy_set_header Forwarded                $proxy_add_forwarded;
 		proxy_set_header X-Forwarded-For      $proxy_add_x_forwarded_for;
 		proxy_set_header X-Forwarded-Proto   $scheme;
 		proxy_set_header X-Forwarded-Host    $host;
 		proxy_set_header X-Forwarded-Port     $server_port;

 		# Proxy timeouts
 		proxy_connect_timeout         60s;
 		proxy_send_timeout              60s;
 		proxy_read_timeout              60s;

 		proxy_buffers                         256 256k;  
 		proxy_buffer_size                  256k;

 		#Set Nginx Cache
 		add_header X-Cache $upstream_cache_status;
 		if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
 		{
 		 	expires 10080m;
 		}
 		proxy_ignore_headers Set-Cookie Cache-Control expires;
 		proxy_cache cache_one;
 		proxy_cache_key $host$uri$is_args$args;
 		proxy_cache_valid 200 304 301 302 1m;
	}
    }

}

@Nothingness-Void
Copy link
Author

Nothingness-Void commented Jul 21, 2023

我参考了
adams549659584#195
内的nginx配置
运行完之后本站依旧不可用
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants