Eugeny / ajenti-v

Virtual Hosting addon for Ajenti
ajenti.org/#product-ajenti-v
MIT License
225 stars 80 forks source link

ajenti redirects #156

Closed noobscode closed 9 years ago

noobscode commented 9 years ago

when clients try to access some of my https:// websites with http:// ajenti redicrecs them to one of my http:// sites even tho the domain name is a completly different one.

Can I just change my host file or?

Eugeny commented 9 years ago

This means the requested domain didn't match any of the domains set up in Ajenti V. It will redirect to a random website, OR a website whose respective port has "default" option enabled.

noobscode commented 9 years ago

Heres the example. https://nordsec.no redirects to https://hackingdefinedexperts.com How do I fix this?

maby if I set port 80 as default on nordsec.no?

Eugeny commented 9 years ago

Oh, you're using SSL. It looks like you're using an outdated NGINX build, or it was built without SNI support: http://serverfault.com/questions/588358/using-nginx-with-sni SNI is required for multiple virtual hosts over SSL, because SSL handshake and certificate selection normally occurs before client sends the desired website name. SNI works around that.

Eugeny commented 9 years ago

You can check for SNI support with nginx -V. Example:

~/Work/ajenti(branch:master*) » nginx -V                                                                                                            
nginx version: nginx/1.4.6 (Ubuntu)
built by gcc 4.8.2 (Ubuntu 4.8.2-19ubuntu1) 
TLS SNI support enabled <<< this
noobscode commented 9 years ago

hackingdefinedexperts.com is the only domain with an ssl cert. But when someone try to access any of my other domains with https they get redirected to hackingdefinedexperts.com.

nginx version: nginx/1.4.6 (Ubuntu) built by gcc 4.8.2 (Ubuntu 4.8.2-19ubuntu1) TLS SNI support enabled configure arguments: --with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module

Eugeny commented 9 years ago

That's right, if that's the only domain available over the HTTPS port, it will be served when connecting via HTTPS. You can either add a HTTPS placeholder vhost with a default-marked port to block other domains via HTTPS, or add an HTTPS port (443) and certificates to each of other vhosts.

rhnorskov commented 7 years ago

I have having this same issue, is there really no better solution?

noobscode commented 7 years ago

Dette er en gammel tråd. Men tror ikke det vil være noen endringet

tor. 16. feb. 2017 kl. 16.43 skrev Rasmus Nørskov <notifications@github.com

:

I have having this same issue, is there really not better solution?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Eugeny/ajenti-v/issues/156#issuecomment-280366817, or mute the thread https://github.com/notifications/unsubscribe-auth/AK__jjFAOczxYXWh0hehIWQNhly8pmySks5rdG60gaJpZM4Dybx5 .

-- Mvh

Alexander Nordbø

https://www.hackingdefinedexperts.com https://www.facebook.com/hackingdefinedexperts

Stormix commented 7 years ago

I know this issue is OLD and was closed, but here are the steps to solve the problem above: On your Ajenti V websites, go to your https website

  1. On your Ajenti V Dashboard , click websites
  2. Go to your https website and click manage
  3. Go to the advanced tab
  4. In Custom configuration: add ssl on;
  5. In Custom top level configuration: add
    server{
    listen 80;
    server_name playlist-converter.me;
    return 301 https://playlist-converter.me;
    }
  6. Click Apply Changes
  7. Go back to Ajenti V - Websites & Click RESTART WEBSITES
  8. Voilà ! Now accessing your website via http will automaticlly redirect to https.