gpt4 book ai didi

magento - nginx/Varnish/magento-500更改端口时出错

转载 作者:行者123 更新时间:2023-12-03 17:45:16 24 4
gpt4 key购买 nike

我已经在 nginx 上安装了 varnish。我有一些非常大的问题。

我的 default.vcl 是:

backend default {
.host = "127.0.0.1";
.port = "81";

}

我的网站虚拟服务器是:
server {
listen 80;

root /var/www/site.com.ro/public_html;
index index.php index.html index.htm;

# Make site accessible from http://localhost/
server_name www.site.com.ro;

access_log /var/www/site.com.ro/logs/log.access;
error_log /var/www/site.com.ro/logs/log.error error;

location / {
index index.php;
try_files $uri $uri/ @handler;
}

location @handler {
rewrite / /index.php;
}

location /blog {
alias /var/www/site.com.ro/public_html_blog/;
index index.php index.html index.htm;
try_files $uri $uri/ /blog/index.php;
}

location ~ ^/blog(.+\.php)$ { ### This location block was the solution
alias /var/www/site.com.ro/public_html_blog/$1;

fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_read_timeout 300;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

location /doc/ {
alias /usr/share/doc/;
autoindex on;
allow 127.0.0.1;
allow ::1;
deny all;
}

# Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
#location /RequestDenied {
# proxy_pass http://127.0.0.1:8080;
#}

error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
if (!-e $request_filename) {
rewrite / /index.php last;
}

try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_read_timeout 300;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}

}

服务器 {
听80;
# Make site accessible from http://localhost/
server_name site.com.ro;
rewrite ^(.*) http://www.site.com.ro$1 permanent;

}

Varnish 文件是:
DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,256m"

当我尝试将网站的监听端口更改为 81 时,出现 500 错误...
谁能帮我?我不知道我做错了什么。

最佳答案

Varnish配置为监听端口80,并连接到localhost:81。 nginx配置为监听端口80。您没有提到预期的流,但是我正在疯狂地猜测:

client -> varnish:80 -> nginx:81.

您现在发现问题了吗?

暗示:
server {
listen 80;

哦,请确保您在闲逛不熟悉的设置时所使用的测试机(virtualbox-或类似设备)中有一个真正相似的设置。这将使您有时间了解为什么某些东西不起作用,并会获得宝贵的经验,因此您不必弄乱生产现场。

关于magento - nginx/Varnish/magento-500更改端口时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21459594/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com