drupal - How to merge two nginx configurations -


i have 2 nginx configurations. both of them work alone. 1 of them drupal (frontend) , 1 of them backend. @ end have mydomain.com/ = frontend & mydomain.com/backend = backend. unfortunately don't know have make work.

here both configs:

//drupal upstream fcp {       server unix:/var/run/php-fpm.sock; }   server {         listen 80;         server_name www.example.com;         root /usr;         location / {                 index index.php;         }          location ~ \.php$ {                 fastcgi_pass fcp;                 fastcgi_index index.php;                 fastcgi_param script_filename /usr$fastcgi_script_name;                 fastcgi_param path_info $fastcgi_script_name;                 include /usr/local/nginx/conf/fastcgi_params;         } }   // ====== //   // backend-software upstream backend{       server unix:/var/run/php-fpm.sock; } server {     [...]          server_name www.example.com;         root /usr/backend/wwwroot;          #generic definition         location / {                 index  index.php;                 try_files $uri $uri/ /index.php?route=$uri&$args;         }          #backend.net frontend controller (redirect these calls php-fpm)         location ~ ^/index.php {                 fastcgi_pass backend;                 fastcgi_param script_filename /usr/backend/wwwroot$fastcgi_script_name;                 fastcgi_param path_info $fastcgi_script_name;                 include /etc/nginx/fastcgi_params;         }          # internal link files x-accel support         location /_files {                 internal;                 alias /usr/backend/_files/filesource/;         }          #static resources         location /wwwres/ {           expires 365d;                 alias /usr/backend/wwwres/;         }         location ~ ^/wwwres/mod/([^/\.]*)/(.*)$ {           expires 365d;                 alias /usr/backend/modules/$1/wwwres/$2;         }         location ~ ^/wwwres/vendor/([^/\.]*)/([^/\.]*)/(.*)$ {           expires 365d;                 alias /usr/backend/vendor/$1/modules/$2/wwwres/$3;         }         location ~ ^/wwwres/theme/set_([^/\.]*)/(.*)$ {           expires 365d;                 alias /usr/backend/_files/theme_set/$1/$2;         }         location ~ ^/wwwres/theme/([^/\.]*)/(.*)$ {           expires 365d;                 alias /usr/backend/themes/$1/wwwres/$2;         }         location ~ ^/wwwres/vendor_theme/([^/\.]*)/([^/\.]*)/(.*)$ {           expires 365d;                 alias /usr/backend/vendor/$1/themes/$2/wwwres/$3;         }         location ~ ^/_cache/(.*)$ {           expires 365d;                 alias /usr/backend/_cache/$1;         }          #error pages         error_page   404 /static/error/404.php;         error_page   500 504  /static/error/500.php;         error_page   502 /static/error/502.html;         error_page   503 /static/error/503.php;          # deny access .htaccess files, if apache's document root         # concurs nginx's 1         #         location ~ /\.ht {                 deny  all;     } } 

i think can merge these configurations 1 server section. root in section can /usr (from first section - correct?) or /usr/backend/wwwroot. should decide default (www.example.com): /usr/index.php or /usr/backend/wwwroot/index.php. see want /usr/index.php root should /usr. , should add

location /backend {   root /usr/backend;   ... } 

the location /_files , "static resources" right because use alias in every section.

summary:

http {   server_name example.com;   root /usr;   index index.php;    location /backend_uri {     alias /usr/backend; # if "backend_uri"=="backend" (and root /usr) section unnecessary   }    location /_files {     # same post   }    # static resources   # same post } 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -