Results 1 to 15 of 15

Thread: Disable acces by IP

  1. #1
    Join Date
    Jun 2017
    Location
    ZS
    Posts
    78

    Disable acces by IP

    Hi, I want to redirect all to domain, now I can acess by
    domain: https://www.jestpraca.pl
    and by domain/ip like https://ip-193.107.90.20.kylos.net.pl/

    I should edit vhost or htaccess to redirect this https://ip-193.107.90.20.kylos.net.pl/ to domain name?
    Working with Deb 8/DA/CB2/MariaDB10.0/PHP7 | Ogłoszenia Praca & Agencja zatrudnienia & Przychodnia Szczecin

  2. #2
    Join Date
    May 2008
    Posts
    826
    htaccess redirect works fine.

  3. #3
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    13,336
    Hello,

    Nginx does not support .htaccess, so you will need to edit either PHP scripts (easier) of your site or modify templates of Nginx (require more knowledge).

    Normally a default "Nginx is functioning normally" page from Directadmin should be shown for every request to a server over hostname or IP.

    If the site is using a dedicated IP, then you can update the virtual host at Admin level by manually added instructions.
    Regards, Alex G.

    - Get the best commercial DirectAdmin support and hire me on poralix.com
    - Follow and like @Poralix on Facebook

  4. #4
    Join Date
    Jun 2017
    Location
    ZS
    Posts
    78
    I have add this
    #redirect non-www to www
    if ($host ~* ^|DOMAIN|$) {
    return 301 $scheme://www.|DOMAIN|$request_uri;
    }
    and to custom4
    |*if SSL_TEMPLATE="0"|
    return 301 https://$host$request_uri;
    |*endif|
    but still I can acess with IP and domain name

    when I have add only return 301 https://www.jestpraca.pl; I have redirect loop
    Working with Deb 8/DA/CB2/MariaDB10.0/PHP7 | Ogłoszenia Praca & Agencja zatrudnienia & Przychodnia Szczecin

  5. #5
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    13,336
    For a correct redirect

    1. remove custom4
    2. install a pre-release Directadmin: https://github.com/poralix/directadm...ee/master/core
    3. use native force redirect to www-domain feature: https://www.directadmin.com/features.php?id=2365
    Regards, Alex G.

    - Get the best commercial DirectAdmin support and hire me on poralix.com
    - Follow and like @Poralix on Facebook

  6. #6
    Join Date
    Jun 2017
    Location
    ZS
    Posts
    78
    1. I have remove custom4
    2. I have install beta DA (1.56.4)
    3. This feature is in 1.57 but I can't download this beta version (your script download only 1.56.4 v)
    Last edited by Mattpl; 05-21-2019 at 01:37 AM.
    Working with Deb 8/DA/CB2/MariaDB10.0/PHP7 | Ogłoszenia Praca & Agencja zatrudnienia & Przychodnia Szczecin

  7. #7
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    13,336
    The pre-release version always shows the current release version. You should check the Compile time, which will be the most recent, see:

    Code:
    [+] Directadmin beta version installed
    Version: DirectAdmin v.1.56.4
    Compiled on 'CentOS 7.0 64-Bit'
    Compile time: May 20 2019 at 22:18:44
    Timestamp: '1558412280'
    Compiled with IPv6
    Regards, Alex G.

    - Get the best commercial DirectAdmin support and hire me on poralix.com
    - Follow and like @Poralix on Facebook

  8. #8
    Join Date
    Jun 2017
    Location
    ZS
    Posts
    78
    ok, thanks now I have option with www but still I can acces from this url https://ip-193.107.90.20.kylos.net.pl/
    trying with http http://ip-193.107.90.20.kylos.net.pl/ and this redirection is ok
    Last edited by Mattpl; 05-21-2019 at 02:47 AM.
    Working with Deb 8/DA/CB2/MariaDB10.0/PHP7 | Ogłoszenia Praca & Agencja zatrudnienia & Przychodnia Szczecin

  9. #9
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    13,336
    You might enable "[x] Force SSL with https redirect" option
    Regards, Alex G.

    - Get the best commercial DirectAdmin support and hire me on poralix.com
    - Follow and like @Poralix on Facebook

  10. #10
    Join Date
    Jun 2017
    Location
    ZS
    Posts
    78
    I have this enable after update. I think that someting wrong is with my vhosts conf.
    Last edited by Mattpl; 05-21-2019 at 03:05 AM.
    Working with Deb 8/DA/CB2/MariaDB10.0/PHP7 | Ogłoszenia Praca & Agencja zatrudnienia & Przychodnia Szczecin

  11. #11
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    13,336
    Do your custom Nginx templates need an update?

    Code:
    ls -l /usr/local/directadmin/data/templates/custom/nginx*.conf
    Are they missing

    Code:
    |FORCE_SSL_REDIRECT|
    ?


    p.s. It's working on my end.
    Regards, Alex G.

    - Get the best commercial DirectAdmin support and hire me on poralix.com
    - Follow and like @Poralix on Facebook

  12. #12
    Join Date
    Jun 2017
    Location
    ZS
    Posts
    78
    Templates with force ssl in
    only /usr/local/directadmin/data/templates/custom/nginx_server.conf



    I have look at two machines this url https://ip-193.107.90.20.kylos.net.pl/ not redirect to domain name but this http://ip-193.107.90.20.kylos.net.pl/ is ok and redirect.
    Working with Deb 8/DA/CB2/MariaDB10.0/PHP7 | Ogłoszenia Praca & Agencja zatrudnienia & Przychodnia Szczecin

  13. #13
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    13,336
    The 4 templates should have it:

    Code:
    # grep '|FORCE_SSL_REDIRECT|' nginx*conf
    nginx_server.conf:      |FORCE_SSL_REDIRECT|
    nginx_server_secure.conf:       |FORCE_SSL_REDIRECT|
    nginx_server_secure_sub.conf:   |FORCE_SSL_REDIRECT|
    nginx_server_sub.conf:  |FORCE_SSL_REDIRECT|

    you need to fix your templates.
    Regards, Alex G.

    - Get the best commercial DirectAdmin support and hire me on poralix.com
    - Follow and like @Poralix on Facebook

  14. #14
    Join Date
    Jun 2017
    Location
    ZS
    Posts
    78
    Need only add |FORCE_SSL_REDIRECT| to them and rebuild nginx??
    I don't have two templates

    nginx_server_secure_sub.conf
    nginx_server_sub.conf

    but this two are here /usr/local/directadmin/data/templates/
    i have copy them to ./custom now (have force_ssl) and still url https://ip-193.107.90.20.kylos.net.pl/ working without redirect to domain name
    Last edited by Mattpl; 05-21-2019 at 03:48 AM.
    Working with Deb 8/DA/CB2/MariaDB10.0/PHP7 | Ogłoszenia Praca & Agencja zatrudnienia & Przychodnia Szczecin

  15. #15
    Join Date
    Apr 2005
    Location
    GMT +7.00
    Posts
    13,336
    Show nginx.conf in full here. You can find it under /usr/local/directadmin/data/users/user/nginx.conf, where user is an username under which you host your site.
    Regards, Alex G.

    - Get the best commercial DirectAdmin support and hire me on poralix.com
    - Follow and like @Poralix on Facebook

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •