Page 1 of 1
redirecting the default website to panel login page
Posted: Mon Dec 22, 2014 1:33 pm
by eagles051387
I have nginx acting as a reverse proxy to apache. If I go to panel.domain.com for example it takes me to a clients website instead. What do I need to do to be able to redirect that to the vesta cp login page instead?
Re: redirecting the default website to panel login page
Posted: Sun Dec 28, 2014 7:42 pm
by drMacFaulty
Have you deleted default.domain? Everything incorrect will normally be redirected here (because it was first in the list). You can redirect them by creating a config file in /etc/nginx/conf.d (Debian location) with the name 000-default or any other digit that is smaller than the other files in there (this ensures it will be loaded first) and make in that server block inside the file you created a redirect to your vesta panel domain.
For example:
Code: Select all
server {
listen 80;
# Make server_name invalid, so that it doesn't match anything you already defined
server_name _;
# Redirect without query string
return 301 http://your-panel-domain-name-here.com;
# Redirect with query string
return 301 http://your-panel-domain-name-here.com$request_uri;
}
Source:
http://wiki.nginx.org/HttpRewriteModule#return
Hope this helps
Re: redirecting the default website to panel login page
Posted: Wed Dec 31, 2014 8:16 am
by eagles051387
I have nginx as a reverse proxy not Do I still need to put a virtual host there or at apache as apache is the default webserver
Re: redirecting the default website to panel login page
Posted: Tue Jan 27, 2015 7:18 pm
by drMacFaulty
eagles051387 wrote:I have nginx as a reverse proxy not Do I still need to put a virtual host there or at apache as apache is the default webserver
The web browser of the client talks to Nginx (as Apache is the back-end application server). So I still recommend to use it on the Nginx side. Though, if you wish, you can also add an Apache virtualhost.
Re: redirecting the default website to panel login page
Posted: Wed Jan 28, 2015 6:54 am
by eagles051387
drMacFaulty wrote:Have you deleted default.domain? Everything incorrect will normally be redirected here (because it was first in the list). You can redirect them by creating a config file in /etc/nginx/conf.d (Debian location) with the name 000-default or any other digit that is smaller than the other files in there (this ensures it will be loaded first) and make in that server block inside the file you created a redirect to your vesta panel domain.
For example:
Code: Select all
server {
listen 80;
# Make server_name invalid, so that it doesn't match anything you already defined
server_name _;
# Redirect without query string
return 301 http://your-panel-domain-name-here.com;
# Redirect with query string
return 301 http://your-panel-domain-name-here.com$request_uri;
}
Source:
http://wiki.nginx.org/HttpRewriteModule#return
Hope this helps
Would you mind giving an example obviously with dummy data of what this should look like as I am a bit lost since I am more familiar with apache