2013-08-31 1 views
0

나는 이것에 대해 많은 기사를보고 있었지만 아무것도 도움이되지 못했습니다!Magento/Nginx - 서브 디렉토리 멀티 캐스트

Nginx로 Redhat에 바닐라 마젠타 인스턴스를 설치했습니다. 기본 저장소는 예상대로 작동하지만 하위 디렉토리 "/ privatesales"를 사용하여 구성된 별도의 웹 사이트를 실행하려고 시도합니다.

server { 
listen 192.168.01; ##changed for security 
listen 80; 
listen 443 ssl; 

ssl_certificate  /etc/nginx/certs/server.crt; 
ssl_certificate_key /etc/nginx/certs/server.key; 
ssl_session_timeout 7m; 
## Specify your SSL options here 
ssl_protocols SSLv2 SSLv3 TLSv1; 
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; 
ssl_prefer_server_ciphers on; 

access_log /var/log/nginx/vanillamagento.local-access.log; 
error_log /var/log/nginx/vanillamagento.local-error.log; 

server_name vanilla.domain.com; 
root /var/www/vanillamagento/magento; 
include conf/vanillamagento_rewrites.conf; 
include conf/vanillamagento_security.conf; 

# PHP handler 
location ~ \.php { 
    ## Catch 404s that try_files miss 
    if (!-e $request_filename) { rewrite//index.php last; } 

    ## Store code is defined in administration > Configuration > Manage Stores 
## fastcgi_param MAGE_RUN_CODE default; 
## fastcgi_param MAGE_RUN_TYPE store; 

    # By default, only handle fcgi without caching 
    include conf/magento_fcgi.conf; 
} 

# 404s are handled by front controller 
location @magefc { 
    rewrite//index.php; 
} 

# Last path match hands to magento or sets global cache-control 
location/{ 
    ## Maintenance page overrides front controller 
    index index.html index.php; 
    try_files $uri $uri/ @magefc; 
    expires 24h; 
} 
} 

나는이 작업을 얻기 위해 다음과 같은 방법을 시도 :

내의 nginx/conf.d/sitename.conf는 포함

1 - index.php를

에 추가 스위치 기능
$host = explode(':', $_SERVER['HTTP_HOST']); 
switch ($host[0]) { 
case 'vanilla.domain.com/privatesales': 
    $store = 'private'; 
    $type = 'website'; 
    break; 

default: 
    $store = 'base'; 
    $type = 'store'; 
} 

2 - 다음을 nginx config (conf/vanillamagento_rewrites.conf)에 추가 한 다음/privatesales 디렉토리를 웹 루트

로 심볼릭 링크 시키십시오
location ~* \.php$ { 
if (!-e $request_filename) { 
    rewrite//index.php last; 
} 
expires off; 
set $runcode default; 
set $runtype store; 
if ($request_uri ~* ^/privatesales) { 
     set $runcode private; 
     set $runtype website; 
} 
fastcgi_pass 127.0.0.1:9000; 
#fastcgi_param HTTPS $fastcgi_https; 
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
fastcgi_param MAGE_RUN_CODE $runcode; 
fastcgi_param MAGE_RUN_TYPE $runtype; 
include fastcgi_params; 
} 

2 일 동안이 문제를 해결하기 위해 노력하고 있습니다. P. 감사!

+0

특정 소프트웨어에 대한 구성 질문과 같은 소리가 들리 죠. 해당 소프트웨어 공급 업체에 문의하여 지원 옵션 및/또는 해당 소프트웨어 전용 Q & A 웹 사이트에 문의하십시오 (Stackoverflow는 FAQ에 설명 된 * Programming * 관련 질문입니다). – hakre

+1

이 질문은 제 3 자 소프트웨어 (Magento)를 구성하기 때문에 주제와 관련이없는 것처럼 보입니다. – hakre

답변

1

마침내 작동했습니다! 전환 후 URL을 수정해야합니다! index.php에 다음을 추가하십시오.

$host = explode("/",$_SERVER['REQUEST_URI']); 

//print_r($host); die(); 
switch ($host[1]) { 
case 'privatesales': 
$_SERVER['REQUEST_URI']=str_replace("/privatesales","",$_SERVER['REQUEST_URI']); 
$mageRunCode = "privatesales"; 
$mageRunType = "store"; 
//$store = 'privatesales'; 
//$type = 'website'; 
break; 

default: 
$mageRunCode = 'default'; 
$mageRunType = 'store'; 
break; 
} 
Mage::run($mageRunCode, $mageRunType);