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:
- created new instance with same files as the backend
- changed the admin url from the backend to be http://admin.example.com/
- Set up Magento backend on a separate node
- tried both disable and enable the auto redirect to base url.
- disabled and enabled ssl in the backend
- 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";