Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


I'm desperate with Apache and DNS
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

I'm desperate with Apache and DNS

netomxnetomx Moderator, Veteran
edited July 2013 in Help

Hello. I'm desesperate now! I don't know what I've done to have this! Damn you, Karma!

TL;DR:

If I enter to www.mysite.com, it will go to my site, but if I enter to: mysite.com, it will go to the default virtualhost :/

My dns have:

myip - A - mysite.com
www - CNAME - @ (the domain)

apache config:

<VirtualHost *:80> ServerName mysite.com ServerAlias www.mysite.com ServerAdmin [email protected] DocumentRoot /var/www/mysite ErrorLog /var/log/apache2/mysite-error.log CustomLog /var/log/apache2/mysite-access.log combined <Directory "/var/www/mysite"> Options FollowSymLinks -Indexes -MultiViews AllowOverride All allow from all </Directory> </VirtualHost>

What is happening? :c

thanks! :*

Comments

  • blackblack Member
    edited July 2013

    Try putting the actual domain name:80 instead of *:80

  • netomxnetomx Moderator, Veteran

    code didn't work. But, well, the domain name on the virtualhost? I haven't do that in my other vps and no problems :S

  • perennateperennate Member, Host Rep

    The configuration looks good, so maybe it's problem somewhere else.

    You can of course play around with telnet to make it more clear where problem lies:

    telnet 1.1.1.1 80
    GET / HTTP/1.1
    Host: testdomain.com
  • natestammnatestamm Member
    edited July 2013

    When you say apache config you are not using sites-available/sites-enabled a2ensite-file with the name.com as file name?




    Your domain name is obviously resolving to your server Ip + Your server and or apache is not correctly setup for name based virtual hosting. I can't really make out what you have with your DNS up there but provided that is setup properly you'll want to then get that code out of your apache conf or httpd conf files for properly setup named based virtual hosts using sites-available/ directory. Which isn't really NEEDED but it makes your life easier. And that's assuming that /var/www/yoursite is correct also. Are you sure you don't just have some default server file there with the It works! text? I also put manually configured web servers at /var/www/vhosts also, and get rid of all that extra stuff you need like two lines in your virtual host containers. And after you make the changes recommended above are you restarting the web server? You actually get a message I believe advising you to reload. So try a service apache2 reload. Are you clearing your browser cache or do you have any settings therein which could be keeping an old file.

  • netomxnetomx Moderator, Veteran

    @natestamm

    ls /etc/apache2/sites-enabled/ 000-default mysite

    @perennate I'm trying that.. I have written this in the telnet session:

    GET / HTTP/1.1 Host: testdomain.com

    But it replies: connection timeout (in http)

  • perennateperennate Member, Host Rep

    netomx: you have to press enter twice after writing the Host: line.

  • netomxnetomx Moderator, Veteran

    @perennate it closes XD

  • netomxnetomx Moderator, Veteran

    Well, I'm trying to check if it is CloudFlare, and setup a MaraDNS, but it is not resolving. @Francisco, do you have a firewall for DNS?

  • JanevskiJanevski Member
    edited July 2013

    @netomx I am wondering, is it possible by any chance that You're seeing a previously cached page that existed pre-configiration? Try clearing the cache, try other browser. Another thing first, /etc/init.d/apache2 stop /etc/init.d/apache2 start, however i strongly believe that You have done that already.

  • If you still need help I can remote or what ever PM me here or get at me on skype @myname happy to help

  • netomxnetomx Moderator, Veteran

    @Janevski yup, have tried severl browsers, several devices, several networks... weird.. it seems it is apache the problem.

  • Doubtful

  • netomxnetomx Moderator, Veteran

    @natestamm said:
    Doubtful

    what is doubtful?

  • netomxnetomx Moderator, Veteran

    it is getting stranger... I have dded a ServerAlias with a subdomain... and works!

  • netomxnetomx Moderator, Veteran

    @perennate ok i do it ith telnet, and read the output.... but no useful output

  • Turn off cloudflare, or edit your hosts file to point to that server directly.

  • netomxnetomx Moderator, Veteran

    @FRCorey said:
    Turn off cloudflare, or edit your hosts file to point to that server directly.

    did that too... i just gave up, redirect it to another server, and will format the vps (when the new stallion comes up), and try again :c

  • JanevskiJanevski Member
    edited July 2013

    @netomx said:
    Janevski yup, have tried severl browsers, several devices, several networks... weird.. it seems it is apache the problem.

    I know it probably won't be the solution, but what about instead of www.mysite.com You enter wildcard *.mysite.com?
    This works for me in one particular scenario:

    <VirtualHost *:80> DocumentRoot "/var/webroot/mysite.com" ServerAlias *.mysite.com ServerName mysite.com <Directory "/var/webroot/mysite.com"> allow from all Options +Indexes </Directory> </VirtualHost>

    Anyhow it beats me, i think Your configuration is good.

    PS: Vanilla killed my <>s.

    PPS: Never mind.

  • prae5prae5 Member

    Whats in your 000-default config - any conflicts in there?

  • netomxnetomx Moderator, Veteran

    000-default is the default one, no edits

    Anyway, I gave up. Will reformat VPS and start from scratch... And test where is the problem

  • prae5prae5 Member

    what is in the default one though, is it responding to mysite.com - disable it if you aren't using it.

  • netomxnetomx Moderator, Veteran

    In fact, I am not using that, I'm using just 1 site, but I like things to be as clean as possible. That thing (redirecting to default) just tells me there a problem I'm gonna face sooner or later.

  • prae5prae5 Member

    disable it if your aren't using it and then try again a2dissite 000-default

  • twaintwain Member

    Not really a fix but you could change docroot in your 000-default

  • Maybe some .htaccess rules?

  • netomxnetomx Moderator, Veteran

    I thought it was an .htaccess rule, but it doesn't have it. I will reformat, don't worry, thanks 4 all

  • ServerName www.example.com
    ServerAlias example.com

    on dns:

    www aname ip

    • aname ip
      remove cname
Sign In or Register to comment.