尝试安装nginx代理时发生错误502

我很新,这可能是一个愚蠢的问题:/

所以我试图在nginx上启用caching,但是当我重新加载服务器时,我将以“502 Bad Getaway”

我知道哪一行破坏了一切,但我不知道为什么以及如何解决这个问题。

proxy_pass http://127.0.0.1/; 

如果我评论这一行这个网站正在工作,但没有明显的caching。

有人能解释我什么我想失踪吗?

整个conf文件:

 #GE CONFIG (DOT NOT REMOVE!) include forge-conf/dev.mywebsite.com/before/*; proxy_cache_path /var/cache keys_zone=one:10m levels=1:2 inactive=60m use_temp_path=off; map $sent_http_content_type $expires { default off; text/html epoch; text/css max; application/javascript max; ~image/ max; } server { listen 80; server_name dev.mywebsite.com; root /home/forge/dev.mywebsite.com/public; # FORGE SSL (DO NOT REMOVE!) # ssl_certificate; # ssl_certificate_key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; index index.html index.htm index.php; charset utf-8; # FORGE CONFIG (DOT NOT REMOVE!) include forge-conf/dev.mywebsite.com/server/*; location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } #access_log /var/log/mywebsite.acces.log; error_log /var/log/nginx/dev.mywebsite.com-error.log error; error_page 404 /index.php; location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; fastcgi_index index.php; include fastcgi_params; } location ~ /\.ht { deny all; } location / { try_files $uri $uri/ /index.php?$query_string; ### # Proxy Swag ### proxy_pass http://127.0.0.1/; proxy_cache one; proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; } # FORGE CONFIG (DOT NOT REMOVE!) 

当您将来自端口80的Web服务器服务的请求代理到同一端口时,您正在使用此configuration进行无限的代理循环。

您需要使用fastcgi_cache指令来cachingFastCGI内容。