Question

NGINGX Redirections

  • Posted January 20, 2014

I have a quick question around nginx server. I have setup eight server blpcks(virtual host). One virtual host was setup to redirect, whenever I visit a page that is unavailble on any of my other sitesI am automatically redirected per the setup of the one site for redirection instead of an error page. How would I change this behaviour.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

You need to create a default virtualhost. If you don’t have one enabled, nginx will use the first virtualhost (Domain A’s) as the default. <br> <br>Create a file called <code>/etc/nginx/sites-enabled/0-default</code> with <a href='https://p.kk7.me/pisusekota.nginx">this</a> as its contents.

Let me explain better. I have domain A redirected to a youtube channel. I now try to visit domain B but I enter some part of the url wrong. Instead of getting an error page I am redirected to the youtube channel…
<br> <br>Pastebin Domain A config <br>http://pastebin.com/5S510Vy7 <br>Pastebin Domain B config <br>http://pastebin.com/RUcKE1vN

<blockquote>One virtual host was setup to redirect, whenever I visit a page that is unavailble on any of my other sitesI am automatically redirected per the setup of the one site for redirection instead of an error page. How would I change this behaviour.</blockquote>I’m not sure I understand what you mean. Can you give an example? Also pastebin your nginx config.