Welcome! Log In Create A New Profile

Advanced

Nginx Magento multistore configuration

Posted by J_12 
Nginx Magento multistore configuration
July 13, 2015 05:59PM
There is a website that has multiple subcatogories which are stores in magento:

www.website.com/sub1 www.website.com/sub2 www.website.com/sub3

The server used is ngnix. everything is set up. And used to work, the nginx conf file for this site need to be reconstructed.

at the moment when for example www.website.com/sub1 is requested this wil set the store to store to sub1. which works fine. However when a product is asked i.e. www.website.com/sub1/product this returned a "page not found" error.

If the store is set to sub1 the url www.website.com/product DOES FIND the product without any issues. on the other hand f the store was not set previously, www.website.com/product DID NOT FIND the product.

it seemed that once a store is set the following happens e.g. www.website.com/sub1/product :

sub1->sub1->product == error (because of sub1->sub1)

this should be:

sub1->product.

note that setting the store when www.website.com/sub1/product is requested and then redirecting the site to www.website.com/product is not an option. everything used to work fine! The store setup had not been changed. only the the nginx conf file should be adjusted. any sugestions?

to be more specific: in the root folder there is an index.php file were magento is set to run the website via mage run code. In the root folder there are subfolders one for each store. these folders each contain an index.php file were the store is set. any more info needed?

Any help would be appreciated.

additional info: in the root folder there is an index.php file were magento is set to run the website via mage run code. In the root folder there are subfolders: one for each store. These folders each contain an index.php file were the store is set( again via mage run code) (the stores are being set correctly in these files).

the nginx conf looked like this:




server {

listen 80 default;
server_name website.com;
root /www_folder;
client_max_body_size 10M;

location / {
index index.php;
try_files $uri $uri/ @handler;
expires 30d;
}


location /mage/ {
try_files $uri $uri/ @magehandler;
expires 30d;
}

location @handler {
## Remove trailing slash
rewrite ^/(.*)/$ /$1 permanent;
## Magento uses a common front handler
rewrite / /index.php;
}

location @magehandler {
## Adds a trailing slash to any urls that is missing a trailing slash
rewrite ^(.*[^/])$ $1/ permanent;
## Magento uses a common front handler
rewrite /mage/ /mage/index.php;
}


## These locations would be hidden by .htaccess normally, protected
location ~ (/mage/(app/|includes/|lib/|pkginfo/|var/|errors/local.xml|shell/|tmp/|cron.+)|/\.git/|/\.ht.+)
{deny all;}

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}

location /. { ## Disable .htaccess and other hidden files
return 404;
}

location ~ .php/ {
rewrite ^(.*.php)/ $1 last;
}

location ~ \.php$ {
add_header X-UA-Compatible 'IE=Edge,chrome=1';
try_files $uri =404;
expires off;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
fastcgi_param SERVER_PORT 80;
fastcgi_param HTTPS $fastcgi_https;
}
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 114
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready