1

I want to separate the backend on another server on AWS (not changing the path), Here is my desired design:

  • One EC2 (should be for frontend only and in auto-scaling)
  • One for admin, cron and images source for cloudfront (I think i will need subdomain for it)
  • RDS, REDIS,Cloudfront

I'm using nginx, SSL certificate installed on the ELB.

What i have tried:

  1. created new instance with same files as the backend
  2. changed the admin url from the backend to be http://admin.example.com/
  3. Set up Magento backend on a separate node
  4. tried both disable and enable the auto redirect to base url.
  5. disabled and enabled ssl in the backend
  6. googled for any good documentation (it look like easy thing to do but no one talk in detailed how to do it)

Here is my nginx configuration:

server {
    server_tokens off;
    access_log  off;
    listen 80 default;
    server_name www.example.com *.example.com; 
    root /var/www/vhosts/example.com;

    location / {
        index index.html index.php; 
        try_files $uri $uri/ @handler; 
        expires 30d; 
      if (!-e $request_filename) {
                    rewrite ^/([^?]*)(?:\?(.*))? /index.php?title=$1&$2 last;
            }
    }

    set $ssl "off";
    if ($http_x_forwarded_proto = "https") {
    set $ssl "on";
    }


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


    location @handler { 
        rewrite / /index.php;
                                   }

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

    location ~ .php$ { 
        if (!-e $request_filename) { rewrite / /index.php last; }

        expires        off;
        fastcgi_pass  unix:/var/run/php-fpm/example.sock;
        fastcgi_param  HTTPS $fastcgi_https;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  MAGE_RUN_CODE default; 
        fastcgi_param  MAGE_RUN_TYPE store;
        fastcgi_buffer_size 1024k;
        fastcgi_buffers 512 32k;
        fastcgi_busy_buffers_size 1024k;
        fastcgi_temp_file_write_size 1024k;

        include        fastcgi_params; ## See /etc/nginx/fastcgi_params
    }
}

I disabled any SSL for the backend and updated the nginx configuration for the admin server as below but got (ERR_TOO_MANY_REDIRECTS) error:

server_name admin.example.com *.example.com; 
set $ssl "off";
  • what exactly is your problem? – MagenX Dec 3 '15 at 9:38
  • I don't know what is the right steps to move the backend (admin) to separate server with subdomain (admin.example.com) – MahmoudMustafa Dec 3 '15 at 9:48
0

Here is what you need to do:

  • Create two exact servers
  • Make sure that your files are sync'd (root /var/www/vhosts/example.com;)
  • Your admin server will become your master and you can use Lsync to make sure they are always sync'd
  • Domain admin.example.com will have one IP and your production server will have another Ip address
  • You nginx config files can be identical.
  • In Magento you will choose custom url for admin and point that URL To your new admin server
  • Any files changes and uploads will go to Admin and will get sync'd to your slave server via the Lsync process.
  • You can run Redis through ElastiCache or simply run it on the admin server
  • You should use RDS for your database server
  • Store sessions and cache in REDIS
  • DO NOT SYNC YOU VAR FOLDER

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.