I'm fairly new using Nginx and I've tried so many variations of configs and read NGINX docs but I can't seem to figure it out... please help.. and thank you for helping!
Background: IIS box: wwwdev.company.com
IIS rewrites: match url="^(about-us|sites/company.com|item1|item2)/.*$" ignoreCase="false" action type="Redirect" redirectType="Permanent" url="/contentmoved.html"
item1, item2, etc are virtual directory in IIS.
sites/company.com is in Drupal box (see below).
Drupal boxes: drupal1dev.company.com
What we want accomplish are:
When we browse to wwwdev.company.com/item1*, the host URL gets preserved no matter what the request uris are.
Issue:
When we browse to wwwdev.company.com/item1*, the images that "item1" calls out are in the Drupal box drupal1dev.company.com/sites/company.com/otherargs/ and the images do not load. So when I have the host URL preserved, the requested URL is wwwdev.company.com/sites/company.com/otherargs/. When I browse to this - it tells me the page does not exist - which is true.
NOTE: However, when I browse to the NGINX server name instead, nginx.company.com/item1, all images in the requested URL becomes nginx.company.com/sites/company.com/otherargs/, the images load up (as long as I accept the SSL in a new tab).
Question:
How do I fix Issue #1 to mirror just like using the NGINX server name?
Below are the configs
server.config
server{
server_name wwwdev.company.com;
listen 80;
index index.html index.php;
#Moved to Drupal
location ~* ^/(item1|item2)/(.*)? {
proxy_pass https://drupal1dev.company.com;
include /etc/nginx/conf.d/proxy.inc;
}
location ~* ^/(sites)/(.*) {
proxy_pass https://drupal1dev.company.com;
include /etc/nginx/conf.d/proxy.inc;
}
}
server{
server_name wwwdev.company.com;
listen 443 ssl;
ssl_certificate /etc/nginx/ssl/apache.crt;
ssl_certificate_key /etc/nginx/ssl/apache2014.key;
index index.html index.php;
#Moved to Drupal
location ~* ^/(item1|item2)/(.*) {
proxy_pass https://drupal1dev.company.com;
include /etc/nginx/conf.d/proxy.inc;
}
location ~* ^/(sites)/(.*) {
proxy_pass https://drupal1dev.company.com;
include /etc/nginx/conf.d/proxy.inc;
}
}
proxy.inc
proxy_connect_timeout 59s;
proxy_send_timeout 600;
proxy_read_timeout 600;
proxy_buffer_size 64k;
proxy_buffers 16 32k;
proxy_pass_header Set-Cookie;
proxy_redirect off;
proxy_hide_header Vary;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_set_header Accept-Encoding "";
proxy_ignore_headers Cache-Control Expires;
proxy_set_header Referer $http_referer;
proxy_set_header Host $host;
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-Proto https;
Thank you in advance!
Background: IIS box: wwwdev.company.com
IIS rewrites: match url="^(about-us|sites/company.com|item1|item2)/.*$" ignoreCase="false" action type="Redirect" redirectType="Permanent" url="/contentmoved.html"
item1, item2, etc are virtual directory in IIS.
sites/company.com is in Drupal box (see below).
Drupal boxes: drupal1dev.company.com
What we want accomplish are:
When we browse to wwwdev.company.com/item1*, the host URL gets preserved no matter what the request uris are.
Issue:
When we browse to wwwdev.company.com/item1*, the images that "item1" calls out are in the Drupal box drupal1dev.company.com/sites/company.com/otherargs/ and the images do not load. So when I have the host URL preserved, the requested URL is wwwdev.company.com/sites/company.com/otherargs/. When I browse to this - it tells me the page does not exist - which is true.
NOTE: However, when I browse to the NGINX server name instead, nginx.company.com/item1, all images in the requested URL becomes nginx.company.com/sites/company.com/otherargs/, the images load up (as long as I accept the SSL in a new tab).
Question:
How do I fix Issue #1 to mirror just like using the NGINX server name?
Below are the configs
server.config
server{
server_name wwwdev.company.com;
listen 80;
index index.html index.php;
#Moved to Drupal
location ~* ^/(item1|item2)/(.*)? {
proxy_pass https://drupal1dev.company.com;
include /etc/nginx/conf.d/proxy.inc;
}
location ~* ^/(sites)/(.*) {
proxy_pass https://drupal1dev.company.com;
include /etc/nginx/conf.d/proxy.inc;
}
}
server{
server_name wwwdev.company.com;
listen 443 ssl;
ssl_certificate /etc/nginx/ssl/apache.crt;
ssl_certificate_key /etc/nginx/ssl/apache2014.key;
index index.html index.php;
#Moved to Drupal
location ~* ^/(item1|item2)/(.*) {
proxy_pass https://drupal1dev.company.com;
include /etc/nginx/conf.d/proxy.inc;
}
location ~* ^/(sites)/(.*) {
proxy_pass https://drupal1dev.company.com;
include /etc/nginx/conf.d/proxy.inc;
}
}
proxy.inc
proxy_connect_timeout 59s;
proxy_send_timeout 600;
proxy_read_timeout 600;
proxy_buffer_size 64k;
proxy_buffers 16 32k;
proxy_pass_header Set-Cookie;
proxy_redirect off;
proxy_hide_header Vary;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_set_header Accept-Encoding "";
proxy_ignore_headers Cache-Control Expires;
proxy_set_header Referer $http_referer;
proxy_set_header Host $host;
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-Proto https;
Thank you in advance!