Skip to content

关于”使用Nginx进行配置反向代理“的反馈 #1

@yggcwx

Description

@yggcwx

一、用来反代的自己域名,需要配置https吧?
二、在1panel面板中配置反代网站,按图一的配置,是否正确?配置后无法实现代理,提示”502 Bad Gateway“。
三、在此网站的配置文件中添加您举例的配置文件后,无法提交。
服务内部错误: stderr: 2024/08/16 12:01:16 [emerg] 540#540: "proxy_cache" zone "cache_one" is unknown in /usr/local/openresty/nginx/conf/nginx.conf:47 nginx: [emerg] "proxy_cache" zone "cache_one" is unknown in /usr/local/openresty/nginx/conf/nginx.conf:47 nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test failed

`
#PROXY-START/

location ^~ /
{
proxy_pass https://translate.google.com/;
proxy_set_header Host translate.google.com;
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;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_http_version 1.1;
# proxy_hide_header Upgrade;
proxy_ssl_server_name on;
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

add_header X-Cache $upstream_cache_status;

#Set Nginx Cache


if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
{
	expires 1m;
}
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 10m;

}

#PROXY-END/`

screenshot-1723780558441
screenshot-1723781010140

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions