2016-03-08 99 views
3

我有一台运行在Ubuntu 14.04服务器上的带有Apache2和SSL的Magento。 我已经安装了Varnish,但不知道如何使用SSL进行设置,而不使用Nginx。 这是我当前的vhost文件;Ubuntu 14.04 Apache + SSL服务器,如何配置Varnish

<VirtualHost *:443> 

    ServerName mysite.com 
    ServerAlias www.mysite.com 
    ServerAdmin [email protected] 
    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> 
+0

我投票关闭这一问题作为题外话,因为Stack Overflow是一个[编程相关(http://stackoverflow.com /帮助/话题)问答网站。你的问题不是关于编程。也许你应该在http://magento.stackexchange.com上发布它呢? – Enigmativity

回答

2

根据您当前的Apache的,我会做:

配置您的网站上的其他端口进行监听,8888例如

<VirtualHost *:8888> 
    ServerName mysite.com 
    ServerAlias www.mysite.com 
    ServerAdmin [email protected] 
    DocumentRoot /var/www/mysite.com 

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

然后SSL一个配置为代理光油

<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 

最后配置光油后端使用8888端口

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

简而言之,您不能使用SSL设置Varnish,因为Varnish不支持它。

您有选项

  1. 设置Nginx的(或一些其它SSL - 终止子)的清漆盈充当反向代理,并通过HTTP请求到转发清漆。

  2. 拆分您当前的Apache2服务器(支持SSL)和Varnish之间的流量。端口80上的HTTP流量转到Varnish,端口443上的HTTPS流量转到Apache2。