apache - Ubuntu 14.04 Apache + SSL 服务器,如何配置 Varnish

标签 apache magento ssl nginx varnish

我有一个 Magento 在带有 Apache2 和 SSL 的 Ubuntu 14.04 服务器上运行。 我已经安装了 Varnish,但不确定如何在不使用 Nginx 的情况下使用 SSL 进行设置。 这是我当前的虚拟主机文件;

    <VirtualHost *:443>

    ServerName mysite.com
    ServerAlias www.mysite.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/mysite.com

    <Directory /var/www/mysite.com/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    </Directory>

    SSLEngine on
    SSLCertificateFile /home/ssl/mysite_com.crt
    SSLCertificateKeyFile /home/ssl/mysite.com.key
    SSLCACertificateFile /home/ssl/mysite_com.ca-bundle

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    </VirtualHost>
    <VirtualHost *:80>
    ServerName mysite.com
    RewriteEngine On
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]
    </VirtualHost>

最佳答案

使用您当前的 Apache,我会这样做:

将您的站点配置为监听另一个端口,例如 8888

<VirtualHost *:8888>
   ServerName mysite.com
   ServerAlias www.mysite.com
   ServerAdmin webmaster@localhost
   DocumentRoot /var/www/mysite.com

  <Directory /var/www/mysite.com/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
  </Directory>
</VirtualHost>

然后配置SSL代理到Varnish

<VirtualHost *:443>

  # what you had above plus the following:

  RequestHeader set X-Forwarded-Proto "https"
  ProxyPass / http://localhost:6081/
  ProxyPassReverse / http://localhost:6081/
</VirtualHost>

您将需要一些额外的模块:

sudo a2enmod headers proxy proxy_http proxy_html

最后配置 Varnish 后端使用 8888 端口

backend default {
  .host = "127.0.0.1";
  .port = "8888";
}

关于apache - Ubuntu 14.04 Apache + SSL 服务器,如何配置 Varnish,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35856860/

相关文章:

php - CodeIgniter 项目的第一个 HTTP 请求延迟非常高

php - LAMP 服务器上的 Windows 身份验证

php - Magento 中的定期促销

magento - 如何在magento 2.1中激活自定义主题?

java - 嵌入式 Tomcat 启用 SSL

apache - 让我们用 ECC (P-521) 加密 csr

php - 在 Windows 上使用 XAMPP 安装 PHP YAML 扩展

php - 将 Magento 实时站点复制到本地服务器进行备份

windows - 为 XAMPP 启用 SSL 后 Apache 无法启动

java - 找不到与 ex.ample.com 匹配的主题备用 DNS 名称