Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Dev Section Modification & Patches
  • Search

Forward ip to domain - SSL

Section with modification and patches for Vesta
Post Reply
  • Print view
Advanced search
20 posts
  • Previous
  • 1
  • 2
skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: Forward ip to domain - SSL
  • Quote

Post by skurudo » Tue May 12, 2015 7:20 pm

hafeezksa wrote: Where to keep this .htaccess file ?
In your domain folder..

/home/user/web/yourdomain.tld/public_html
Top

hafeezksa
Posts: 81
Joined: Mon Apr 27, 2015 5:45 pm
Contact:
Contact hafeezksa
Website

Re: Forward ip to domain - SSL
  • Quote

Post by hafeezksa » Tue May 12, 2015 8:24 pm

skurudo wrote:
hafeezksa wrote: Where to keep this .htaccess file ?
In your domain folder..

/home/user/web/yourdomain.tld/public_html
Actually I want to redirect my VPS IP to a domain name I did it in /usr/local/vesta/nginx/conf/nginx.conf
It is ok when I use https+IP, it redirecting to my ssl site, but when I use http+IP without ssl it is redirecting to my an other domain (without ssl). I want to redirect IP to my ssl site even with http or https, how to do that ?
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: Forward ip to domain - SSL
  • Quote

Post by skurudo » Wed May 13, 2015 5:44 am

hafeezksa wrote:Actually I want to redirect my VPS IP to a domain name I did it in /usr/local/vesta/nginx/conf/nginx.conf
It is ok when I use https+IP, it redirecting to my ssl site, but when I use http+IP without ssl it is redirecting to my an other domain (without ssl). I want to redirect IP to my ssl site even with http or https, how to do that ?
There already is recipe how to
https://vestacp.com/docs/#how-to-force-https
Top

hafeezksa
Posts: 81
Joined: Mon Apr 27, 2015 5:45 pm
Contact:
Contact hafeezksa
Website

Re: Forward ip to domain - SSL
  • Quote

Post by hafeezksa » Wed May 13, 2015 12:00 pm

skurudo wrote:
hafeezksa wrote:Actually I want to redirect my VPS IP to a domain name I did it in /usr/local/vesta/nginx/conf/nginx.conf
It is ok when I use https+IP, it redirecting to my ssl site, but when I use http+IP without ssl it is redirecting to my an other domain (without ssl). I want to redirect IP to my ssl site even with http or https, how to do that ?
There already is recipe how to
https://vestacp.com/docs/#how-to-force-https
With ssl doamin there is no any problem its ok. Actually, I want to redirect my vps ip to my https site for example if I use this IP URL
http://192.168.1.10 it should redirect to my domain https://mydoamin.com
http://192.168.1.10 (not working) ?
https://192.168.1.10 (working and redirecting ok)
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: Forward ip to domain - SSL
  • Quote

Post by skurudo » Wed May 13, 2015 12:25 pm

Try something like this in /etc/nginx/conf.d/yourip.conf

Code: Select all

error_page      497 https://mydoamin.com;
Top

hafeezksa
Posts: 81
Joined: Mon Apr 27, 2015 5:45 pm
Contact:
Contact hafeezksa
Website

Re: Forward ip to domain - SSL
  • Quote

Post by hafeezksa » Thu May 14, 2015 4:43 pm

skurudo wrote:Try something like this in /etc/nginx/conf.d/yourip.conf

Code: Select all

error_page      497 https://mydoamin.com;
I add this code after restarting vesta service, I am not able to start vesta service even I remove this code from conf file.
There is error as below:
# service vesta start
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
[FAILED]
How to fix this problem?
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: Forward ip to domain - SSL
  • Quote

Post by skurudo » Sun May 17, 2015 4:51 pm

Code: Select all

/etc/init.d/apache2 stop
/etc/init.d/nginx stop
/etc/init.d/nginx start
/etc/init.d/apache2 start
Where you exactly put this string?
Top

hafeezksa
Posts: 81
Joined: Mon Apr 27, 2015 5:45 pm
Contact:
Contact hafeezksa
Website

Re: Forward ip to domain - SSL
  • Quote

Post by hafeezksa » Sun May 17, 2015 5:08 pm

skurudo wrote:

Code: Select all

/etc/init.d/apache2 stop
/etc/init.d/nginx stop
/etc/init.d/nginx start
/etc/init.d/apache2 start
Where you exactly put this string?
Regarding error in my above post, there was my mistake some days ago in nginx.conf I changed (under Vhost) vesta port from 8083 to 80 and I forget to return it. The problem was fixed.
Top

skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: Forward ip to domain - SSL
  • Quote

Post by skurudo » Sun May 17, 2015 5:15 pm

hafeezksa wrote: Regarding error in my above post, there was my mistake some days ago in nginx.conf I changed (under Vhost) vesta port from 8083 to 80 and I forget to return it. The problem was fixed.
Oh, so it is ;-) Nice.
Top

weirdaljr
Posts: 14
Joined: Tue Jul 28, 2015 2:46 pm

Re: Forward ip to domain - SSL
  • Quote

Post by weirdaljr » Tue Oct 06, 2015 1:09 am

hafeezksa wrote:
skurudo wrote:
hafeezksa wrote:Actually I want to redirect my VPS IP to a domain name I did it in /usr/local/vesta/nginx/conf/nginx.conf
It is ok when I use https+IP, it redirecting to my ssl site, but when I use http+IP without ssl it is redirecting to my an other domain (without ssl). I want to redirect IP to my ssl site even with http or https, how to do that ?
There already is recipe how to
https://vestacp.com/docs/#how-to-force-https
With ssl doamin there is no any problem its ok. Actually, I want to redirect my vps ip to my https site for example if I use this IP URL
http://192.168.1.10 it should redirect to my domain https://mydoamin.com
http://192.168.1.10 (not working) ?
https://192.168.1.10 (working and redirecting ok)

I was running into the same issue and I just got it to work on my VPS by editing the one nginx conf below. This worked for me on a 1 IP VPS running Ubuntu with default templates:

/etc/nginx/conf.d/[IP ADDRESS].conf

Code: Select all

server {
    listen       [IP ADDRESS]:80 default;
    server_name  _;
    access_log  /var/log/nginx/[IP ADDRESS].log main;
    location / {
         return 301 https://DOMAINNAME.com;
   }
}
Top


Post Reply
  • Print view

20 posts
  • Previous
  • 1
  • 2

Return to “Modification & Patches”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password