redirecting the default website to panel login page
-
- Posts: 40
- Joined: Mon Dec 22, 2014 1:29 pm
redirecting the default website to panel login page
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?
-
- Posts: 88
- Joined: Thu Mar 06, 2014 7:52 pm
- Contact:
Re: redirecting the default website to panel login page
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:
Source: http://wiki.nginx.org/HttpRewriteModule#return
Hope this helps
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;
}
Hope this helps
-
- Posts: 40
- Joined: Mon Dec 22, 2014 1:29 pm
Re: redirecting the default website to panel login page
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
-
- Posts: 88
- Joined: Thu Mar 06, 2014 7:52 pm
- Contact:
Re: redirecting the default website to panel login page
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.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
-
- Posts: 40
- Joined: Mon Dec 22, 2014 1:29 pm
Re: redirecting the default website to panel login page
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 apachedrMacFaulty 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:Source: http://wiki.nginx.org/HttpRewriteModule#returnCode: 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; }
Hope this helps