Forward ip to domain - SSL
Re: Forward ip to domain - SSL
In your domain folder..hafeezksa wrote: Where to keep this .htaccess file ?
/home/user/web/yourdomain.tld/public_html
Re: Forward ip to domain - SSL
Actually I want to redirect my VPS IP to a domain name I did it in /usr/local/vesta/nginx/conf/nginx.confskurudo wrote:In your domain folder..hafeezksa wrote: Where to keep this .htaccess file ?
/home/user/web/yourdomain.tld/public_html
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 ?
Re: Forward ip to domain - SSL
There already is recipe how tohafeezksa 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 ?
https://vestacp.com/docs/#how-to-force-https
Re: Forward ip to domain - SSL
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 URLskurudo wrote:There already is recipe how tohafeezksa 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 ?
https://vestacp.com/docs/#how-to-force-https
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)
Re: Forward ip to domain - SSL
Try something like this in /etc/nginx/conf.d/yourip.conf
Code: Select all
error_page 497 https://mydoamin.com;
Re: Forward ip to domain - SSL
I add this code after restarting vesta service, I am not able to start vesta service even I remove this code from conf file.skurudo wrote:Try something like this in /etc/nginx/conf.d/yourip.confCode: Select all
error_page 497 https://mydoamin.com;
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?
Re: Forward ip to domain - SSL
Code: Select all
/etc/init.d/apache2 stop
/etc/init.d/nginx stop
/etc/init.d/nginx start
/etc/init.d/apache2 start
Re: Forward ip to domain - SSL
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.skurudo wrote:Where you exactly put this string?Code: Select all
/etc/init.d/apache2 stop /etc/init.d/nginx stop /etc/init.d/nginx start /etc/init.d/apache2 start
Re: Forward ip to domain - SSL
Oh, so it is ;-) Nice.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.
Re: Forward ip to domain - SSL
hafeezksa wrote: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 URLskurudo wrote:There already is recipe how tohafeezksa 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 ?
https://vestacp.com/docs/#how-to-force-https
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;
}
}