AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[magento](server)

Martin Hope
Major Kuprich
Asked: 2021-10-01 10:21:08 +0800 CST

带有基本身份验证的清漆返回 401

  • 1

我尝试使用以下解决方案在具有基本身份验证身份验证的服务器上配置 Varnish:

  • https://stackoverflow.com/a/40424168/7202171
  • https://blog.tenya.me/blog/2011/12/14/varnish-http-authentication/#comment-2882579903

但这无济于事。Varnish 日志仍然显示 401 错误:

varnishlog -g raw -i Backend_health

         0 Backend_health - mag2.default Still sick 4--X-R- 0 5 10 0.001574 0.000000 HTTP/1.1 401 Unauthorized

我的清漆配置(4.0 版):

vcl 4.0;

import std;
# The minimal Varnish version is 4.0
# For SSL offloading, pass the following header in your proxy server or load balancer: 'X-Forwarded-Proto: https'

backend default {
    .host = "127.0.0.1";
    .port = "8080";
    .first_byte_timeout = 600s;
    .probe = {
        .url = "/health_check.php";
        .timeout = 2s;
        .interval = 5s;
        .window = 10;
        .threshold = 5;
   }
}

acl purge {
    "localhost";
}

sub vcl_recv {
    if (! req.http.Authorization ~ "Basic ZGV2OmRldg=") {
    return(synth(401, "Restricted"));
    }

    if (req.method == "PURGE") {
        if (client.ip !~ purge) {
            return (synth(405, "Method not allowed"));
        }
        # To use the X-Pool header for purging varnish during automated deployments, make sure the X-Pool header
        # has been added to the response in your backend server config. This is used, for example, by the
        # capistrano-magento2 gem for purging old content from varnish during it's deploy routine.
        if (!req.http.X-Magento-Tags-Pattern && !req.http.X-Pool) {
            return (synth(400, "X-Magento-Tags-Pattern or X-Pool header required"));
        }
        if (req.http.X-Magento-Tags-Pattern) {
          ban("obj.http.X-Magento-Tags ~ " + req.http.X-Magento-Tags-Pattern);
        }
        if (req.http.X-Pool) {
          ban("obj.http.X-Pool ~ " + req.http.X-Pool);
        }
        return (synth(200, "Purged"));
    }

    if (req.method != "GET" &&
        req.method != "HEAD" &&
        req.method != "PUT" &&
        req.method != "POST" &&
        req.method != "TRACE" &&
        req.method != "OPTIONS" &&
        req.method != "DELETE") {
          /* Non-RFC2616 or CONNECT which is weird. */
          return (pipe);
    }

    # We only deal with GET and HEAD by default
    if (req.method != "GET" && req.method != "HEAD") {
        return (pass);
    }

    # Bypass shopping cart and checkout
    if (req.url ~ "/checkout") {
        return (pass);
    }

    # Bypass health check requests
    if (req.url ~ "/pub/health_check.php") {
        return (pass);
    }

    # Set initial grace period usage status
    set req.http.grace = "none";

    # normalize url in case of leading HTTP scheme and domain
    set req.url = regsub(req.url, "^http[s]?://", "");

    # collect all cookies
    std.collect(req.http.Cookie);

    # Compression filter. See https://www.varnish-cache.org/trac/wiki/FAQ/Compression
    if (req.http.Accept-Encoding) {
        if (req.url ~ "\.(jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf|flv)$") {
            # No point in compressing these
            unset req.http.Accept-Encoding;
        } elsif (req.http.Accept-Encoding ~ "gzip") {
            set req.http.Accept-Encoding = "gzip";
        } elsif (req.http.Accept-Encoding ~ "deflate" && req.http.user-agent !~ "MSIE") {
            set req.http.Accept-Encoding = "deflate";
        } else {
            # unknown algorithm
            unset req.http.Accept-Encoding;
        }
    }

    # Remove all marketing get parameters to minimize the cache objects
    if (req.url ~ "(\?|&)(gclid|cx|ie|cof|siteurl|zanpid|origin|fbclid|mc_[a-z]+|utm_[a-z]+|_bta_[a-z]+)=") {
        set req.url = regsuball(req.url, "(gclid|cx|ie|cof|siteurl|zanpid|origin|fbclid|mc_[a-z]+|utm_[a-z]+|_bta_[a-z]+)=[-_A-z0-9+()%.]+&?", "");
        set req.url = regsub(req.url, "[?|&]+$", "");
    }

    # Static files caching
    if (req.url ~ "^/(pub/)?(media|static)/") {
        # Static files should not be cached by default
        return (pass);

        # But if you use a few locales and don't use CDN you can enable caching static files by commenting previous line (#return (pass);) and uncommenting next 3 lines
        #unset req.http.Https;
        #unset req.http.X-Forwarded-Proto;
        #unset req.http.Cookie;
    }

     # Authenticated GraphQL requests should not be cached by default
    if (req.url ~ "/graphql" && req.http.Authorization ~ "^Bearer") {
        return (pass);
    }

unset req.http.Authorization;
    return (hash);
}

sub vcl_hash {
    if (req.http.cookie ~ "X-Magento-Vary=") {
        hash_data(regsub(req.http.cookie, "^.*?X-Magento-Vary=([^;]+);*.*$", "\1"));
    }

    if (req.url ~ "/graphql") {
        call process_graphql_headers;
    }

    # To make sure http users don't see ssl warning
    if (req.http.X-Forwarded-Proto) {
        hash_data(req.http.X-Forwarded-Proto);
    }
    
}

sub process_graphql_headers {
    if (req.http.Store) {
        hash_data(req.http.Store);
    }
    if (req.http.Content-Currency) {
        hash_data(req.http.Content-Currency);
    }
}

sub vcl_backend_fetch {
    # auth with admin:admin
    set bereq.http.Authorization = "Basic ZGV2OmRldg==";
}

sub vcl_backend_response {

    set beresp.grace = 3d;

    if (beresp.http.content-type ~ "text") {
        set beresp.do_esi = true;
    }

    if (bereq.url ~ "\.js$" || beresp.http.content-type ~ "text") {
        set beresp.do_gzip = true;
    }

    if (beresp.http.X-Magento-Debug) {
        set beresp.http.X-Magento-Cache-Control = beresp.http.Cache-Control;
    }

    # cache only successfully responses and 404s
    if (beresp.status != 200 && beresp.status != 404) {
        set beresp.ttl = 0s;
        set beresp.uncacheable = true;
        return (deliver);
    } elsif (beresp.http.Cache-Control ~ "private") {
        set beresp.uncacheable = true;
        set beresp.ttl = 86400s;
        return (deliver);
    }

    # validate if we need to cache it and prevent from setting cookie
    if (beresp.ttl > 0s && (bereq.method == "GET" || bereq.method == "HEAD")) {
        unset beresp.http.set-cookie;
    }

   # If page is not cacheable then bypass varnish for 2 minutes as Hit-For-Pass
   if (beresp.ttl <= 0s ||
       beresp.http.Surrogate-control ~ "no-store" ||
       (!beresp.http.Surrogate-Control &&
       beresp.http.Cache-Control ~ "no-cache|no-store") ||
       beresp.http.Vary == "*") {
       # Mark as Hit-For-Pass for the next 2 minutes
        set beresp.ttl = 120s;
        set beresp.uncacheable = true;
    }

    return (deliver);
}

sub vcl_deliver {
    if (resp.http.X-Magento-Debug) {
        if (resp.http.x-varnish ~ " ") {
            set resp.http.X-Magento-Cache-Debug = "HIT";
            set resp.http.Grace = req.http.grace;
        } else {
            set resp.http.X-Magento-Cache-Debug = "MISS";
        }
    } else {
        unset resp.http.Age;
    }

    # Not letting browser to cache non-static files.
    if (resp.http.Cache-Control !~ "private" && req.url !~ "^/(pub/)?(media|static)/") {
        set resp.http.Pragma = "no-cache";
        set resp.http.Expires = "-1";
        set resp.http.Cache-Control = "no-store, no-cache, must-revalidate, max-age=0";
    }

    unset resp.http.X-Magento-Debug;
    unset resp.http.X-Magento-Tags;
    unset resp.http.X-Powered-By;
    unset resp.http.Server;
    unset resp.http.X-Varnish;
    unset resp.http.Via;
    unset resp.http.Link;
}

sub vcl_hit {
    if (obj.ttl >= 0s) {
        # Hit within TTL period
        return (deliver);
    }
    if (std.healthy(req.backend_hint)) {
        if (obj.ttl + 300s > 0s) {
            # Hit after TTL expiration, but within grace period
            set req.http.grace = "normal (healthy server)";
            return (deliver);
        } else {
            # Hit after TTL and grace expiration
            return (fetch);
        }
    } else {
        # server is not healthy, retrieve from cache
        set req.http.grace = "unlimited (unhealthy server)";
        return (deliver);
    }
}

sub vcl_synth {
  if (resp.status == 401) {
    set resp.status = 401;
    set resp.http.WWW-Authenticate = "Basic";
    return(deliver);
  }
}
magento nginx varnish http-basic-authentication authorization
  • 1 个回答
  • 570 Views
Martin Hope
cedler
Asked: 2021-06-23 12:42:12 +0800 CST

magento 安装成功,但前端出现 apache 欢迎页面

  • 0

我在 ionos 有一个 VPS,一个 centos 8 os。我已经安装了 LAMP、elsticsearch、rabbit 等...我在 namecheaped.com 上为我的域提供了 SSL EV:ortie-bio.fr 和www.ortie-bio.fr 我已按照此教程安装 Magento 开源 2.4 .2: https ://www.linode.com/docs/guides/install-magento-2-4-on-centos-8/ 最后我确实选择了作曲家安装,如下所述: https://devdocs .magento.com/guides/v2.4/install-gde/composer.html Magento 安装成功完成,但是当我在浏览器中转到 ortie-bio.fr 时,它会显示默认的 apache 欢迎页面...我确实使用 etc/httpd/conf 目录作为我的证书,也许而不是 etc/ssl 目录但我已经测试并且它可以工作,正如您在下面看到的那样,我在 public_html 目录中放置了一个 index.html:https ://www.ortie-bio.fr/index.html 在我的安装命令中,我有:

--base-url=https://www.ortie-bio.fr/  --use-rewrites=1 --use-secure=1 --base-url-secure=https://www.ortie-bio.fr/ --use-secure-admin=1

有任何想法吗?

centos installation magento ssl certificate
  • 1 个回答
  • 84 Views
Martin Hope
Paul Fan
Asked: 2020-10-29 21:41:21 +0800 CST

我的 Magento 只能加载第一个首页,所有页面都是 404。 Nginx 服务器配置问题

  • 0

我正在尝试在 WSL、ubuntu Nginx 网络服务器、localhost 上运行 Magento 2 我只能加载我的网站第一个首页,但其余页面找不到 404。我只修改 /etc/nginx/sites-available/default 文件。因为我使用的是 localhost 并且只有 1 个站点。我想我不需要创建另一个。谁能帮我看看我的配置文件有什么问题?/etc/nginx/sites-available/默认。我对 Nginx 不熟悉,我确实尝试了 google 很多天,仍然找不到任何解决方案。

如果有人可以提供帮助,我将不胜感激。

  # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        root /var/www/html/Magento2_PAUL;

        # Add index.php to the list if you are using PHP
        index index.php;

        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;
                # proxy_pass http://localhost:8080;
                # proxy_http_version 1.1;
                # proxy_set_header Upgrade $http_upgrade;
                # proxy_set_header Connection 'upgrade';
                # proxy_set_header Host $host;
                # proxy_cache_bypass $http_upgrade;
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
         include snippets/fastcgi-php.conf;
        #
        #       # With php7.0-cgi alone:
        #       fastcgi_pass 127.0.0.1:9000;
        #       # With php7.0-fpm:
               fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        }

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


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#       listen 80;
#       listen [::]:80;
#
#       server_name example.com;
#
#       root /var/www/example.com;
#       index index.html;
#
#       location / {
#              try_files $uri $uri/ =404;
#       }
#
magento nginx http-status-code-404 windows-subsystem-for-linux
  • 1 个回答
  • 97 Views
Martin Hope
J W
Asked: 2020-06-08 12:29:54 +0800 CST

设置为 1 的 httpd_can_network_connect 在 SELinux 上实际打开了多少

  • -1

当我尝试将用户重定向到 Paypal 进行结帐时,我的日志文件中出现以下 SELinux denied 行。请您帮助我理解它的含义以及我应该向 SELinux 添加哪些例外以允许这些例外?

type=AVC msg=audit(1591554743.559:10135): avc:  denied  { name_connect } for  pid=3389 comm="httpd" dest=80 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:http_port_t:s0 tclass=tcp_socket permissive=0
type=SYSCALL msg=audit(1591554743.559:10135): arch=c000003e syscall=42 success=no exit=-13 a0=19 a1=7f6a14077238 a2=10 a3=26 items=0 ppid=981 pid=3389 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm="httpd" exe="/usr/sbin/httpd" subj=system_u:system_r:httpd_t:s0 key=(null)ARCH=x86_64 SYSCALL=connect AUID="unset" UID="apache" GID="apache" EUID="apache" SUID="apache" FSUID="apache" EGID="apache" SGID="apache" FSGID="apache"
type=PROCTITLE msg=audit(1591554743.559:10135): proctitle=2F7573722F7362696E2F6874747064002D44464F524547524F554E44 

type=AVC msg=audit(1591554758.933:10140): avc:  denied  { name_connect } for  pid=5728 comm="php-fpm" dest=80 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:http_port_t:s0 tclass=tcp_socket permissive=0
type=SYSCALL msg=audit(1591554758.933:10140): arch=c000003e syscall=42 success=no exit=-13 a0=b a1=7f2e0555cf50 a2=10 a3=1bd7a524e1bda8 items=0 ppid=977 pid=5728 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm="php-fpm" exe="/usr/sbin/php-fpm" subj=system_u:system_r:httpd_t:s0 key=(null)ARCH=x86_64 SYSCALL=connect AUID="unset" UID="apache" GID="apache" EUID="apache" SUID="apache" FSUID="apache" EGID="apache" SGID="apache" FSGID="apache"
type=PROCTITLE msg=audit(1591554758.933:10140): proctitle=7068702D66706D3A20706F6F6C20777777

根据我的研究,它看起来像“在 ENFORCING 模式下启用时,默认情况下,SELinux 会阻止 Apache Web 服务器建立网络连接。在托管 Apache Web 服务器的机器上,将 SELinux 配置为允许 httpd 网络连接” RedHat

# /usr/sbin/setsebool httpd_can_network_connect 1

我只是想更多地了解从安全的角度来看这实际上打开了多少,以及它是否添加了过于广泛的异常。

此外,如果有任何方法可以限制此布尔规则的域。

非常感谢大家的帮助:)

centos php magento centos8 selinux
  • 2 个回答
  • 3280 Views
Martin Hope
WackGet
Asked: 2020-03-25 22:10:54 +0800 CST

与 Apache ProxyPass 一起使用时,Varnish 正在删除 X-Forwarded-For 标头

  • 0

我正在使用 Varnish 4 和 Apache 的ProxyPass指令来尝试在 HTTPS 网站(运行 Magento 电子商务软件)上缓存内容。

Varnish 监听 80 端口,Apache 监听 8080(HTTP)和 443(HTTPS)端口。

在我的 SSL vhost 中,我有一个 ProxyPass 指令来将 HTTPS 请求代理到 Varnish 服务器,如下所示:

    # Reverse proxy configuration for Varnish
    ProxyPreserveHost On
    ProxyPass         / http://127.0.0.1:80/
    RequestHeader     set X-Forwarded-Port "443"
    RequestHeader     set X-Forwarded-Proto "https"

我的问题是这些代理请求似乎没有X-Forwarded-For标头(或我能看到的任何其他标头)。我做到了LogLevel trace4,这是通过 Varnish 代理后到达端口 8080 服务器的内容:

http_request.c(437): [client 127.0.0.1:44580] Headers received from client:
http_request.c(441): [client 127.0.0.1:44580]   Host: 127.0.0.1
http_request.c(441): [client 127.0.0.1:44580]   Connection: close

Magento 提供的 Varnish 配置文件如下。

它似乎没有删除标题,当我通过添加std.syslog(0, req.http.X-Forwarded-For);到 VCL 文件进行一些调试时,我能够在日志输出中看到标题。

有任何想法吗?

vcl 4.0;

import std;
# The minimal Varnish version is 4.0
# For SSL offloading, pass the following header in your proxy server or load balancer: 'X-Forwarded-Proto: https'

backend default {
    .host = "127.0.0.1";
    .port = "8080";
    .first_byte_timeout = 600s;
    .probe = {
        .url = "/pub/health_check.php";
        .timeout = 2s;
        .interval = 5s;
        .window = 10;
        .threshold = 5;
   }
}

acl purge {
    "localhost";
}

sub vcl_recv {
    if (req.method == "PURGE") {
        if (client.ip !~ purge) {
            return (synth(405, "Method not allowed"));
        }
        # To use the X-Pool header for purging varnish during automated deployments, make sure the X-Pool header
        # has been added to the response in your backend server config. This is used, for example, by the
        # capistrano-magento2 gem for purging old content from varnish during it's deploy routine.
        if (!req.http.X-Magento-Tags-Pattern && !req.http.X-Pool) {
            return (synth(400, "X-Magento-Tags-Pattern or X-Pool header required"));
        }
        if (req.http.X-Magento-Tags-Pattern) {
          ban("obj.http.X-Magento-Tags ~ " + req.http.X-Magento-Tags-Pattern);
        }
        if (req.http.X-Pool) {
          ban("obj.http.X-Pool ~ " + req.http.X-Pool);
        }
        return (synth(200, "Purged"));
    }

    if (req.method != "GET" &&
        req.method != "HEAD" &&
        req.method != "PUT" &&
        req.method != "POST" &&
        req.method != "TRACE" &&
        req.method != "OPTIONS" &&
        req.method != "DELETE") {
          /* Non-RFC2616 or CONNECT which is weird. */
          return (pipe);
    }

    # We only deal with GET and HEAD by default
    if (req.method != "GET" && req.method != "HEAD") {
        return (pass);
    }

    # Bypass shopping cart, checkout and search requests
    if (req.url ~ "/checkout" || req.url ~ "/catalogsearch") {
        return (pass);
    }

    # Bypass health check requests
    if (req.url ~ "/pub/health_check.php") {
        return (pass);
    }

    # Set initial grace period usage status
    set req.http.grace = "none";

    # normalize url in case of leading HTTP scheme and domain
    set req.url = regsub(req.url, "^http[s]?://", "");

    # collect all cookies
    std.collect(req.http.Cookie);

    # Compression filter. See https://www.varnish-cache.org/trac/wiki/FAQ/Compression
    if (req.http.Accept-Encoding) {
        if (req.url ~ "\.(jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf|flv)$") {
            # No point in compressing these
            unset req.http.Accept-Encoding;
        } elsif (req.http.Accept-Encoding ~ "gzip") {
            set req.http.Accept-Encoding = "gzip";
        } elsif (req.http.Accept-Encoding ~ "deflate" && req.http.user-agent !~ "MSIE") {
            set req.http.Accept-Encoding = "deflate";
        } else {
            # unknown algorithm
            unset req.http.Accept-Encoding;
        }
    }

    # Remove all marketing get parameters to minimize the cache objects
    if (req.url ~ "(\?|&)(gclid|cx|ie|cof|siteurl|zanpid|origin|fbclid|mc_[a-z]+|utm_[a-z]+|_bta_[a-z]+)=") {
        set req.url = regsuball(req.url, "(gclid|cx|ie|cof|siteurl|zanpid|origin|fbclid|mc_[a-z]+|utm_[a-z]+|_bta_[a-z]+)=[-_A-z0-9+()%.]+&?", "");
        set req.url = regsub(req.url, "[?|&]+$", "");
    }

    # Static files caching
    if (req.url ~ "^/(pub/)?(media|static)/") {
        # Static files should not be cached by default
        return (pass);

        # But if you use a few locales and don't use CDN you can enable caching static files by commenting previous line (#return (pass);) and uncommenting next 3 lines
        #unset req.http.Https;
        #unset req.http.X-Forwarded-Proto;
        #unset req.http.Cookie;
    }

    return (hash);
}

sub vcl_hash {
    if (req.http.cookie ~ "X-Magento-Vary=") {
        hash_data(regsub(req.http.cookie, "^.*?X-Magento-Vary=([^;]+);*.*$", "\1"));
    }

    # For multi site configurations to not cache each other's content
    if (req.http.host) {
        hash_data(req.http.host);
    } else {
        hash_data(server.ip);
    }

    if (req.url ~ "/graphql") {
        call process_graphql_headers;
    }

    # To make sure http users don't see ssl warning
    if (req.http.X-Forwarded-Proto) {
        hash_data(req.http.X-Forwarded-Proto);
    }
    if (req.http.user-agent ~ "(?i)theme_blank") {
        hash_data("1");
    } elsif (req.http.user-agent ~ "(?i)theme_luma") {
        hash_data("3");
    }
}

sub process_graphql_headers {
    if (req.http.Store) {
        hash_data(req.http.Store);
    }
    if (req.http.Content-Currency) {
        hash_data(req.http.Content-Currency);
    }
}

sub vcl_backend_response {

    set beresp.grace = 3d;

    if (beresp.http.content-type ~ "text") {
        set beresp.do_esi = true;
    }

    if (bereq.url ~ "\.js$" || beresp.http.content-type ~ "text") {
        set beresp.do_gzip = true;
    }

    if (beresp.http.X-Magento-Debug) {
        set beresp.http.X-Magento-Cache-Control = beresp.http.Cache-Control;
    }

    # cache only successfully responses and 404s
    if (beresp.status != 200 && beresp.status != 404) {
        set beresp.ttl = 0s;
        set beresp.uncacheable = true;
        return (deliver);
    } elsif (beresp.http.Cache-Control ~ "private") {
        set beresp.uncacheable = true;
        set beresp.ttl = 86400s;
        return (deliver);
    }

    # validate if we need to cache it and prevent from setting cookie
    if (beresp.ttl > 0s && (bereq.method == "GET" || bereq.method == "HEAD")) {
        unset beresp.http.set-cookie;
    }

   # If page is not cacheable then bypass varnish for 2 minutes as Hit-For-Pass
   if (beresp.ttl <= 0s ||
       beresp.http.Surrogate-control ~ "no-store" ||
       (!beresp.http.Surrogate-Control &&
       beresp.http.Cache-Control ~ "no-cache|no-store") ||
       beresp.http.Vary == "*") {
       # Mark as Hit-For-Pass for the next 2 minutes
        set beresp.ttl = 120s;
        set beresp.uncacheable = true;
    }

    return (deliver);
}

sub vcl_deliver {
    if (resp.http.X-Magento-Debug) {
        if (resp.http.x-varnish ~ " ") {
            set resp.http.X-Magento-Cache-Debug = "HIT";
            set resp.http.Grace = req.http.grace;
        } else {
            set resp.http.X-Magento-Cache-Debug = "MISS";
        }
    } else {
        unset resp.http.Age;
    }

    # Not letting browser to cache non-static files.
    if (resp.http.Cache-Control !~ "private" && req.url !~ "^/(pub/)?(media|static)/") {
        set resp.http.Pragma = "no-cache";
        set resp.http.Expires = "-1";
        set resp.http.Cache-Control = "no-store, no-cache, must-revalidate, max-age=0";
    }

    unset resp.http.X-Magento-Debug;
    unset resp.http.X-Magento-Tags;
    unset resp.http.X-Powered-By;
    unset resp.http.Server;
    unset resp.http.X-Varnish;
    unset resp.http.Via;
    unset resp.http.Link;
}

sub vcl_hit {
    if (obj.ttl >= 0s) {
        # Hit within TTL period
        return (deliver);
    }
    if (std.healthy(req.backend_hint)) {
        if (obj.ttl + 300s > 0s) {
            # Hit after TTL expiration, but within grace period
            set req.http.grace = "normal (healthy server)";
            return (deliver);
        } else {
            # Hit after TTL and grace expiration
            return (fetch);
        }
    } else {
        # server is not healthy, retrieve from cache
        set req.http.grace = "unlimited (unhealthy server)";
        return (deliver);
    }
}
magento varnish apache-2.4
  • 1 个回答
  • 2254 Views
Martin Hope
dipole_moment
Asked: 2016-12-13 12:49:52 +0800 CST

Redis服务器高cpu调试策略

  • 3

最近,我们注意到由 redis 引起的生产环境中的 CPU 峰值,如下所示:

在此处输入图像描述

为了解决这个问题,我每天大约重新启动两次 redis 服务器 :( 这显然远非理想。我想找出根本原因。

到目前为止,我已经研究过以下一些事情:
1) 查看 redis 日志文件中的任何异常情况。以下似乎是可疑的:

在此处输入图像描述

2) 研究 nginx 访问日志,看看我们是否遇到异常高的流量。答案是不。

3) New Relic 透露该问题始于 11 月 21 日,16 日`(大约一个月前),但当时没有发布任何代码。

以下是有关我们设置的一些详细信息:

Redis 服务器: Redis server v=2.8.17 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=64a9cf396cbcc4c7

PHP: 5.3.27使用 fpm

Redis配置:

daemonize yes
pidfile /var/run/redis/redis.pid
port 6379
timeout 0
tcp-keepalive 0
loglevel notice
logfile /var/log/redis/redis.log
syslog-enabled yes
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error no
rdbcompression yes
rdbchecksum yes
dbfilename redis.rdb
dir /var/lib/redis/
slave-serve-stale-data yes
slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100
maxmemory 15GB
appendonly no
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-max-len 128
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
include /etc/redis/conf.d/local.conf

框架:带有 Cm_Cache_Backend_Redis 的 Magento 1.7.2

如果给出上述信息,请告诉我是否可以采取任何措施来减轻 CPU 的高使用率。

cache magento php-fpm redis cpu-usage
  • 1 个回答
  • 3497 Views
Martin Hope
Dushyant Joshi
Asked: 2016-09-09 22:40:37 +0800 CST

Apache 服务器与 PCI 的兼容性

  • -2

我不知道这是否是一个合适的地方问,所以请帮我解决这个问题。

问:我想知道 Apache Web 服务器是否兼容 PCI Compliant Payment 环境。

apache-2.2 magento pci-dss
  • 1 个回答
  • 59 Views
Martin Hope
fff
Asked: 2016-09-08 23:11:18 +0800 CST

在此服务器上找不到请求的 URL /magento/

  • -1

我尝试从 web 安装 magaento2 和 php7 apache2。

它成功了。安装成功。

Magento Admin Info:

Username:
admin
Email:
[email protected]
Password:
******
Your Store Address:
http://localhost/magento/
Magento Admin Address:
http://localhost/magento/admin/

但是当我点击这些链接时

我有错误

Not Found

The requested URL /magento/ was not found on this server.

Apache/2.4.18 (Ubuntu) Server at localhost Port 80

在其他话题中,人们说

去

/etc/php/7.0/apache2/conf.d

和一些线条。但是在那个目录中,我有很多 ini,它不是 texxtfile

“/etc/php/7.0/apache2/conf.d” is a directory.

当我尝试打开机智 gedit

我现在能做什么?

但对于

gedit /etc/apache2/apache2.conf

表明

# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.4/ for detailed information about
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
# hints.
#
#
# Summary of how the Apache 2 configuration works in Debian:
# The Apache 2 web server configuration in Debian is quite different to
# upstream's suggested way to configure the web server. This is because Debian's
# default Apache2 installation attempts to make adding and removing modules,
# virtual hosts, and extra configuration directives as flexible as possible, in
# order to make automating the changes and administering the server as easy as
# possible.

# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#
#   /etc/apache2/
#   |-- apache2.conf
#   |   `--  ports.conf
#   |-- mods-enabled
#   |   |-- *.load
#   |   `-- *.conf
#   |-- conf-enabled
#   |   `-- *.conf
#   `-- sites-enabled
#       `-- *.conf
#
#
# * apache2.conf is the main configuration file (this file). It puts the pieces
#   together by including all remaining configuration files when starting up the
#   web server.
#
# * ports.conf is always included from the main configuration file. It is
#   supposed to determine listening ports for incoming connections which can be
#   customized anytime.
#
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
#   directories contain particular configuration snippets which manage modules,
#   global configuration fragments, or virtual host configurations,
#   respectively.
#
#   They are activated by symlinking available configuration files from their
#   respective *-available/ counterparts. These should be managed by using our
#   helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
#   their respective man pages for detailed information.
#
# * The binary is called apache2. Due to the use of environment variables, in
#   the default configuration, apache2 needs to be started/stopped with
#   /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
#   work with the default configuration.


# Global configuration
#

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the Mutex documentation (available
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
#ServerRoot "/etc/apache2"

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
Mutex file:${APACHE_LOCK_DIR} default

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5


# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log

#
# LogLevel: Control the severity of messages logged to the error_log.
# Available values: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the log level for particular modules, e.g.
# "LogLevel info ssl:warn"
#
LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf


# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All 
    Require all granted
</Directory>

#<Directory /srv/>
#   Options Indexes FollowSymLinks
#   AllowOverride None
#   Require all granted
#</Directory>




# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
    Require all denied
</FilesMatch>


#
# The following directives define some format nicknames for use with
# a CustomLog directive.
#
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
#
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

当我更改某些部分时,它会影响本地主机根。例如,当我 dsable 时,localhost 被禁止。

这是错误日志

[Thu Sep 08 10:08:07.838247 2016] [mpm_prefork:notice] [pid 27202] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 10:08:07.838287 2016] [core:notice] [pid 27202] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 10:08:10.217465 2016] [mpm_prefork:notice] [pid 27202] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Thu Sep 08 10:08:10.264056 2016] [mpm_prefork:notice] [pid 27202] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 10:08:10.264067 2016] [core:notice] [pid 27202] AH00094: Command line: '/usr/sbin/apache2'

在

/var/log/apache2/error.log

我也像这样创建了 apache.conf

<VirtualHost *:80>
    DocumentRoot /var/www/html
    <Directory /var/www/html/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
    </Directory>
</VirtualHost>

在

/etc/apache2/sites-available/magento.conf

然后做了这个

sudo a2ensite magento.conf
sudo a2dissite 000-default.conf

我从这里看但是

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-magento-on-ubuntu-14-04

但没有任何改变

这是错误日志

[Thu Sep 08 10:08:07.838247 2016] [mpm_prefork:notice] [pid 27202] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 10:08:07.838287 2016] [core:notice] [pid 27202] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 10:08:10.217465 2016] [mpm_prefork:notice] [pid 27202] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Thu Sep 08 10:08:10.264056 2016] [mpm_prefork:notice] [pid 27202] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 10:08:10.264067 2016] [core:notice] [pid 27202] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 10:16:00.449232 2016] [mpm_prefork:notice] [pid 27202] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Thu Sep 08 10:16:00.507141 2016] [mpm_prefork:notice] [pid 27202] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 10:16:00.507153 2016] [core:notice] [pid 27202] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 10:16:43.105955 2016] [mpm_prefork:notice] [pid 27202] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Thu Sep 08 10:16:43.153499 2016] [mpm_prefork:notice] [pid 27202] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 10:16:43.153511 2016] [core:notice] [pid 27202] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 10:16:48.271177 2016] [mpm_prefork:notice] [pid 27202] AH00169: caught SIGTERM, shutting down
[Thu Sep 08 10:16:49.447808 2016] [mpm_prefork:notice] [pid 27820] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 10:16:49.447838 2016] [core:notice] [pid 27820] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 10:17:51.567331 2016] [mpm_prefork:notice] [pid 27820] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Thu Sep 08 10:17:51.614927 2016] [mpm_prefork:notice] [pid 27820] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 10:17:51.614939 2016] [core:notice] [pid 27820] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 10:17:52.825263 2016] [mpm_prefork:notice] [pid 27820] AH00169: caught SIGTERM, shutting down
[Thu Sep 08 10:17:53.964814 2016] [mpm_prefork:notice] [pid 27945] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 10:17:53.964843 2016] [core:notice] [pid 27945] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 10:41:21.587129 2016] [mpm_prefork:notice] [pid 27945] AH00169: caught SIGTERM, shutting down
[Thu Sep 08 10:41:22.768479 2016] [mpm_prefork:notice] [pid 29209] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 10:41:22.768509 2016] [core:notice] [pid 29209] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 10:42:13.155839 2016] [mpm_prefork:notice] [pid 29209] AH00169: caught SIGTERM, shutting down
[Thu Sep 08 10:42:14.279786 2016] [mpm_prefork:notice] [pid 29294] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 10:42:14.279817 2016] [core:notice] [pid 29294] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 11:08:48.917446 2016] [mpm_prefork:notice] [pid 29294] AH00169: caught SIGTERM, shutting down
[Thu Sep 08 11:08:49.998267 2016] [mpm_prefork:notice] [pid 30868] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 11:08:49.998299 2016] [core:notice] [pid 30868] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 11:12:36.227958 2016] [mpm_prefork:notice] [pid 30868] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Thu Sep 08 11:12:36.276950 2016] [mpm_prefork:notice] [pid 30868] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 11:12:36.276962 2016] [core:notice] [pid 30868] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 11:12:43.920686 2016] [mpm_prefork:notice] [pid 30868] AH00169: caught SIGTERM, shutting down
[Thu Sep 08 11:12:44.975202 2016] [mpm_prefork:notice] [pid 31184] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 11:12:44.975231 2016] [core:notice] [pid 31184] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 11:15:09.691761 2016] [mpm_prefork:notice] [pid 31184] AH00169: caught SIGTERM, shutting down
[Thu Sep 08 11:15:10.852670 2016] [mpm_prefork:notice] [pid 31344] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 11:15:10.852705 2016] [core:notice] [pid 31344] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 11:15:13.627029 2016] [mpm_prefork:notice] [pid 31344] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Thu Sep 08 11:15:13.675088 2016] [mpm_prefork:notice] [pid 31344] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 11:15:13.675101 2016] [core:notice] [pid 31344] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 11:17:09.348813 2016] [mpm_prefork:notice] [pid 31344] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Thu Sep 08 11:17:09.395006 2016] [mpm_prefork:notice] [pid 31344] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 11:17:09.395019 2016] [core:notice] [pid 31344] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 11:17:13.322077 2016] [mpm_prefork:notice] [pid 31344] AH00169: caught SIGTERM, shutting down
[Thu Sep 08 11:17:14.497462 2016] [mpm_prefork:notice] [pid 31549] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 11:17:14.497501 2016] [core:notice] [pid 31549] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 11:21:17.796019 2016] [mpm_prefork:notice] [pid 31549] AH00169: caught SIGTERM, shutting down
[Thu Sep 08 11:21:18.939220 2016] [mpm_prefork:notice] [pid 31739] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 11:21:18.939252 2016] [core:notice] [pid 31739] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 11:21:21.925933 2016] [mpm_prefork:notice] [pid 31739] AH00171: Graceful restart requested, doing restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[Thu Sep 08 11:21:21.971902 2016] [mpm_prefork:notice] [pid 31739] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 11:21:21.971914 2016] [core:notice] [pid 31739] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 11:27:29.795435 2016] [mpm_prefork:notice] [pid 31739] AH00169: caught SIGTERM, shutting down
[Thu Sep 08 11:27:30.880443 2016] [mpm_prefork:notice] [pid 32048] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 11:27:30.880477 2016] [core:notice] [pid 32048] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 11:41:14.883168 2016] [mpm_prefork:notice] [pid 32048] AH00169: caught SIGTERM, shutting down
[Thu Sep 08 11:41:16.021082 2016] [mpm_prefork:notice] [pid 606] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 11:41:16.021125 2016] [core:notice] [pid 606] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 11:47:06.305602 2016] [mpm_prefork:notice] [pid 606] AH00169: caught SIGTERM, shutting down
[Thu Sep 08 11:47:07.457794 2016] [mpm_prefork:notice] [pid 864] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 11:47:07.457825 2016] [core:notice] [pid 864] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 11:50:48.006471 2016] [mpm_prefork:notice] [pid 864] AH00169: caught SIGTERM, shutting down
[Thu Sep 08 11:50:49.149710 2016] [mpm_prefork:notice] [pid 1126] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 11:50:49.149743 2016] [core:notice] [pid 1126] AH00094: Command line: '/usr/sbin/apache2'
[Thu Sep 08 11:51:20.235219 2016] [mpm_prefork:notice] [pid 1126] AH00169: caught SIGTERM, shutting down
[Thu Sep 08 11:51:21.377260 2016] [mpm_prefork:notice] [pid 1210] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 11:51:21.377295 2016] [core:notice] [pid 1210] AH00094: Command line: '/usr/sbin/apache2'

为了

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message

我做了

https://askubuntu.com/a/448403/590851

这里

这些是@gloom700 建议的日志

Generate custom log for your site. Below DocumentRoot add 2 lines . "CustomLog /var/log/apache2/mysite-access.log combined" "ErrorLog /var/log/apache2/mysite-error.log" Restart the service and check these log files 

我把这些放到我的 apache conf 中。

这是仅在 apache 重新启动后的错误日志

[Thu Sep 08 12:38:08.630069 2016] [mpm_prefork:notice] [pid 4059] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 12:38:08.630108 2016] [core:notice] [pid 4059] AH00094: Command line: '/usr/sbin/apache2'


now i try to navigate to

本地主机/magento

没有错误日志,但可以访问

127.0.0.1 - - [08/Sep/2016:12:38:49 +0300] "GET /magento HTTP/1.1" 404 497 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"

现在我尝试导航到

localhost/magento2 url 更改为

http://localhost/magento/?SID=cq4mo1k2p1pik3me0ufk0p7ae4

访问日志(包括previosu)

127.0.0.1 - - [08/Sep/2016:12:38:49 +0300] "GET /magento HTTP/1.1" 404 497 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:39:25 +0300] "GET /magento2/ HTTP/1.1" 302 490 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:39:25 +0300] "GET /magento/?SID=cq4mo1k2p1pik3me0ufk0p7ae4 HTTP/1.1" 404 497 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"

错误日志

[Thu Sep 08 12:38:08.630069 2016] [mpm_prefork:notice] [pid 4059] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 12:38:08.630108 2016] [core:notice] [pid 4059] AH00094: Command line: '/usr/sbin/apache2'

现在magento / admin没有错误但可以访问

127.0.0.1 - - [08/Sep/2016:12:38:49 +0300] "GET /magento HTTP/1.1" 404 497 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:39:25 +0300] "GET /magento2/ HTTP/1.1" 302 490 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:39:25 +0300] "GET /magento/?SID=cq4mo1k2p1pik3me0ufk0p7ae4 HTTP/1.1" 404 497 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:40:44 +0300] "GET /magento/admin HTTP/1.1" 404 503 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"

现在magento /设置

使用权

127.0.0.1 - - [08/Sep/2016:12:38:49 +0300] "GET /magento HTTP/1.1" 404 497 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:39:25 +0300] "GET /magento2/ HTTP/1.1" 302 490 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:39:25 +0300] "GET /magento/?SID=cq4mo1k2p1pik3me0ufk0p7ae4 HTTP/1.1" 404 497 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:40:44 +0300] "GET /magento/admin HTTP/1.1" 404 503 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:41:20 +0300] "GET /magento/setup/ HTTP/1.1" 404 504 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"

错误

[Thu Sep 08 12:38:08.630069 2016] [mpm_prefork:notice] [pid 4059] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Thu Sep 08 12:38:08.630108 2016] [core:notice] [pid 4059] AH00094: Command line: '/usr/sbin/apache2'

我认为错误仍然没有改变

现在 magento 2/admin

使用权

127.0.0.1 - - [08/Sep/2016:12:38:49 +0300] "GET /magento HTTP/1.1" 404 497 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:39:25 +0300] "GET /magento2/ HTTP/1.1" 302 490 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:39:25 +0300] "GET /magento/?SID=cq4mo1k2p1pik3me0ufk0p7ae4 HTTP/1.1" 404 497 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:40:44 +0300] "GET /magento/admin HTTP/1.1" 404 503 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:41:20 +0300] "GET /magento/setup/ HTTP/1.1" 404 504 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:42:10 +0300] "GET /magento2/admin/ HTTP/1.1" 302 647 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:42:14 +0300] "GET /magento/admin/admin/index/index/key/5693df064035428c19e5fa184b4afa34e077e014143dd178179a37cff78cb0e1/ HTTP/1.1" 404 590 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"127.0.0.1 - - [08/Sep/2016:12:38:49 +0300] "GET /magento HTTP/1.1" 404 497 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:39:25 +0300] "GET /magento2/ HTTP/1.1" 302 490 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:39:25 +0300] "GET /magento/?SID=cq4mo1k2p1pik3me0ufk0p7ae4 HTTP/1.1" 404 497 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:40:44 +0300] "GET /magento/admin HTTP/1.1" 404 503 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:41:20 +0300] "GET /magento/setup/ HTTP/1.1" 404 504 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:42:10 +0300] "GET /magento2/admin/ HTTP/1.1" 302 647 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"
127.0.0.1 - - [08/Sep/2016:12:42:14 +0300] "GET /magento/admin/admin/index/index/key/5693df064035428c19e5fa184b4afa34e077e014143dd178179a37cff78cb0e1/ HTTP/1.1" 404 590 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.92 Safari/537.36"

错误同样仍然认为。

php apache-2.2 magento
  • 3 个回答
  • 6262 Views
Martin Hope
jsims281
Asked: 2016-04-14 08:29:51 +0800 CST

Solr 搜索 - java.util.Map$Entry 无法解析

  • 5

我有 Solr 3.6.2 正在运行并为 Magento Enterprise 站点的搜索提供动力,而且一切正常,启动时没有错误等。

但是,当尝试访问以下管理页面时:

  • /solr/admin/stats.jsp
  • /solr/admin/registry.jsp
  • /solr/admin/analysis.jsp
  • /solr/admin/distributiondump.jsp

我收到以下错误:

Problem accessing /solr/admin/stats.jsp. Reason:

PWC6033: Unable to compile class for JSP

PWC6197: An error occurred at line: 41 in the jsp file: /admin/stats.jsp
PWC6199: Generated servlet error:
The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files



org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP

PWC6197: An error occurred at line: 41 in the jsp file: /admin/stats.jsp
PWC6199: Generated servlet error:
The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files


at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:123)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:296)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:376)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:437)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:608)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:360)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:486)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:380)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327)
at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:283)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

java.util.Map$Entry 总是同样的错误。管理面板中的其他页面似乎工作正常。

java magento solr
  • 2 个回答
  • 1515 Views
Martin Hope
Pedro Peixoto
Asked: 2013-03-23 06:53:58 +0800 CST

不小心将 chown “root” 设置为我所有的服务器

  • 0

我在我的网络服务器上运行 2 个 magento 应用程序,我不小心从服务器的根目录设置了“chown -R www-data:www-data *”。意思是,所有文件都归用户 root 所有。

这立即在 magento 网站上引发了问题,即:mysql 没有连接,因为它应该使用“mysql”用户。

我已经修复了这个问题,并将网页文件设置为 www-data 拥有。

这些网站现在运行良好,但当我尝试完成订单时,它会在超时前挂起一分钟。订单在后台注册,但它没有按预期显示“订单成功页面”。

我正在运行 nginx 和 php-fpm,php-fpm 日志显示为:

[22-Mar-2013 13:31:24] WARNING: [pool www] child 1791, script '/var/www/website.com/index.php' (request: "POST /index.php") execution timed out (1436.378897 sec), terminating
[22-Mar-2013 13:31:24] WARNING: [pool www] child 1791 exited on signal 15 (SIGTERM) after 1600.011818 seconds from start
[22-Mar-2013 13:31:24] NOTICE: [pool www] child 2717 started

发生了什么?发生这种情况是因为某些文件不属于其正确所有者吗?如果是这样,那些是哪些文件/文件夹以及它应该拥有什么所有者?

编辑:它一定与后缀有关。回显“Hello World”的普通 php 脚本呈现得很好,当我将 mail() 函数放在那里时它挂起。

magento postfix nginx php-fpm
  • 2 个回答
  • 551 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve