2014-02-09 3 views
0

Magento & nginx를 실행중인 웹 사이트를 상속 받았습니다. 나는 사실상 nginx에 대해 아무것도 알지 못하고 Magento에 관해 상당한 금액을 알고 있습니다. 사이트가 Amazon Cloudfront CDN을 사용하도록 구성되었지만 모든 이미지 (js & css)가 원본 사이트로 301 리디렉션을 반환합니다. 나는 같은 Magento, MySQL & Cloudfront 설정이 아파치와 함께 실행되는 개발 사이트를 가지고 있기 때문에이 설정으로 올바르게 작동하므로 꽤 nginx 설정 파일에 문제가있는 것으로 확신한다. 파일에 기록 된 일부 재 작성이 있었고 skin.mydomain.com에서 자산에 대한 요청이 이루어지면 CDN에서 파일을 제공하는 대신 www.mydomain.com으로 리디렉션됩니다. js.mydomain.com, skin.mydomain.com 및 cloud.mydomain.com에 대한 CNAME 레코드 설정이 모두 동일한 Cloudfront CDN을 가리키고 있습니다. 여기에 해당되는 것으로 보인다 것의 nginx 설정 파일의 일부는 다음과 같습니다nginx, Magento & Cloudfront

server { 
    listen 80; 
    ##127.0.0.1:8080 
    server_name mydomain.com; 
    rewrite/$scheme://www.$host$request_uri permanent; ## Forcibly prepend a www 
} 

server { 
    listen 80; 
    ##127.0.0.1:8080 default 
     ## SSL directives might go here 
     listen 443 default ssl; 
     ssl_certificate  /etc/nginx/ 
     ssl_certificate_key /etc/nginx/ 

    server_name www.mydomain.com; 
    ## *.mydomain.com; Domain is here twice so server_name_in_redirect will favour the www 
    root /var/www/magento; 

    location/{ 
     index index.html index.php; ## Allow a static html file to be shown first 
     try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler 
     expires 30d; 
     if ($request_uri ~* "\.(ico|css|js|gif|jpe?g|png)$") { 
      access_log off; 
      expires max; 
     } 
     port_in_redirect off; 
    } 

나는이 거의 모든 일에 노력하고 있습니다 어떤 시점에서 작업을 중지 싶습니다 어떤 도움을 주시면 감사하겠습니다 .

감사합니다.

답변

0

첫 번째 server 지시어가 www를 다시 작성해야하는 것으로 보입니다.

server { 
. . . 
    rewrite/$scheme://www.$host$request_uri permanent; ## Forcibly prepend a www 
. . . 
}