Welcome! Log In Create A New Profile

Advanced

Port redirection issues in nginx

Posted by akash94thakur 
Port redirection issues in nginx
September 27, 2012 06:04AM
I am using ngenix + tomcat cofiguration.
I was having a site "domainname.com" hosted by ngnix and running in tomcat.it is running fine.It was running on 80 port in ngenix.
But i was told to run a copy of this site "domainname.com" on 81 port.
So what i did is as follow:-
i deployed the same site in tomcat .
Then in ngenix i copied the old .conf file of "domainname.com" site and created a .conf file to be used for "domainname.com" site on 81 port.
So after restarting the ngenix now when i access the site as "www.domainname.com:81" and log in in to it i am imediatly logged out(same code with www.domainname.com domain on 80 port is running fine but on 81 port this issue is coming. I have got stuck in to this please help me.

Below are the .conf file for both

domainname.com on 80 port.(running perfectly)

server {
listen 80;
server_name domainname.com.com;
rewrite ^(.*) https://$server_name$1 permanent;
}

server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/server.crt;
ssl_certificate_key /etc/nginx/server.key;
server_name domain-qa-dealer.example.com;
error_log /var/log/nginx/domain-qa-error.log;
charset utf-8;

location / {
proxy_pass http://localhost:87;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}

location /userGuide.htm {
rewrite ^(.*) https://secure.domainmobility.com/partners/pcontent/login.jsp;
}

location ~ ^.*/images/exampleLogo.gif$ {
alias /webroot/exchange/images/domainLogo.png;
}

location ~ ^.*/images/progressBarRed.png$ {
alias /webroot/exchange/images/progressBarGreen.png;
}



location ~ ^.*(/css|/images|/scripts|/etc|/skins).*$ {
root /webroot;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

server {
listen 80;
server_name domain-qa-store.example.com;
rewrite ^(.*) https://$server_name$1 permanent;
}

server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/server.crt;
ssl_certificate_key /etc/nginx/server.key;
server_name domain-qa-store.example.com;
error_log /var/log/nginx/domain-qa-error.log;
charset utf-8;

location / {
proxy_pass http://localhost:87;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}

location /userGuide.htm {
rewrite ^(.*) http://example.tmi.domain.com/domainEmployeePortal/content/en/iep/corp_stores/site/corp_stores/store_ops/general/store_management/iep_corp_stores_ref_doc_000100.xml;
}

location /ercOrderSupplies.htm {
rewrite ^(.*) /domainStoreOrderSupplies.htm;
}

location /singlePageCustomerDecision.htm {
rewrite ^(.*) /customerDecisionInvoiceDisplay.htm;
}

location /contactUs.htm {
rewrite ^(.*) /contactUsdomainStore.htm;
}

location ~ ^.*/images/exampleLogo.gif$ {
alias /webroot/exchange/images/domainLogo.png;
}

location ~ ^.*/images/progressBarRed.png$ {
alias /webroot/exchange/images/progressBarGreen.png;
}

location ~ ^.*/css/main.css$ {
alias /webroot/exchange/css/main-domain.css;
}

location ~ ^.*/reports/css/style.css$ {
location ~ ^.*/reports/css/style.css$ {
alias /webroot/reports/css/domainReportStyle.css;
}

location ~ ^.*/exchange/scripts/main.js$ {
alias /webroot/exchange/scripts/main-domain.js;
}

location ~ ^.*(/css|/images|/scripts|/etc|/skins).*$ {
root /webroot;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}






domainname.com on 81 port.(issues:( )
















server {
listen 81;
server_name domainname.com;
error_log /var/log/nginx/domain-error.log;

location / {
proxy_pass http://localhost:100;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
location /userGuide.htm {
rewrite ^(.*) http://secure.domainmobility.com/partners/pcontent/login.jsp;
}


location ~ ^.*/images/exampleLogo.gif$ {
alias /webroot/exchange/images/domainLogo.png;
}

location ~ ^.*/images/progressBarRed.png$ {
alias /webroot/exchange/images/progressBarGreen.png;
}

location ~ ^.*/css/main.css$ {
alias /webroot/exchange/css/main-domain.css;
}

location ~ ^.*/reports/css/style.css$ {
alias /webroot/reports/css/domainReportStyle.css;
}

location ~ ^.*/exchange/scripts/main.js$ {
alias /webroot/exchange/scripts/main-domain.js;
location ~ ^.*(/css|/images|/scripts|/etc|/skins).*$ {
root /webroot;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

server {
listen 81;
server_name domain-qa-store.example.com;
error_log /var/log/nginx/domain-qa-admin-error.log;

location / {
proxy_pass http://localhost:100;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}

location /userGuide.htm {
rewrite ^(.*) http://example.tmi.domain.com/domainEmployeePortal/content/en/iep/corp_stores/site/corp_stores/store_ops/general/store_management/iep_corp_stores_ref_doc_000100.xml;
}

location /ercOrderSupplies.htm {
rewrite ^(.*) /domainStoreOrderSupplies.htm;
}


location /singlePageCustomerDecision.htm {
rewrite ^(.*) /customerDecisionInvoiceDisplay.htm;
}

location /contactUs.htm {
rewrite ^(.*) /contactUsdomainStore.htm;
}

location ~ ^.*/images/exampleLogo.gif$ {
alias /webroot/exchange/images/domainLogo.png;
}

location ~ ^.*/images/progressBarRed.png$ {
alias /webroot/exchange/images/progressBarGreen.png;
}

location ~ ^.*/css/main.css$ {
alias /webroot/exchange/css/main-domain.css;
}

location ~ ^.*/reports/css/style.css$ {
alias /webroot/reports/css/domainReportStyle.css;
}

location ~ ^.*/exchange/scripts/main.js$ {
alias /webroot/exchange/scripts/main-domain.js;
}

location ~ ^.*(/css|/images|/scripts|/etc|/skins).*$ {
root /webroot;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}


Note:-if i am using "rewrite ^(.*) https://$server_name$1 permanent;" in second case even then it is not making any difference.


Please help help help :( :(


Thanks
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 151
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready