No domains or user http://ip/~user adresses work, ip related?

TimTastic

Verified User
Joined
Feb 14, 2013
Messages
9
Hi, im having troubles gettings the virtual hosts to work, from a clean install. This is because i have two ip-adresses, one is private and one is public.

I checked the link below, and everything was correct there:
http://help.directadmin.com/item.php?id=242

I tried debugging using phpinfo(); and found that php server_addr was the private/local ip-adress.

How can i resolve this? Any options?

Thanks
 
Check that your dns matches your virtual host. If they are not the same you will see apache is functioning normally. dns can take up to 72 hours to update. Try clearing your browser cache. Try pinging the domain to see if it matches the ip of the vhost.
 
Check that your dns matches your virtual host. If they are not the same you will see apache is functioning normally. dns can take up to 72 hours to update. Try clearing your browser cache. Try pinging the domain to see if it matches the ip of the vhost.

But that does not explain why : http://1.2.3.4/~myuser dont work.

[Apache error log]

[Thu Feb 14 09:00:41 2013] [error] [client My.pc.ip.adress] File does not exist: /var/www/html/~myuser
 
It doesnt work that way. Just edit the hosts file on your computer to try a domain.
 
Give me ssh access and i will fix it for you than publish the answer here.
 
Then I would say that your vhost is not on the same ip.

Check /usr/local/directadmin/data/users/USERNAME/httpd.conf

Here is the guide for ~user

http://help.directadmin.com/item.php?id=46
i checked and it had the right ip-adress
<VirtualHost my.public.ip.adress:80 >

ServerName www.mysite.com
ServerAlias www.mysite.com mysite.com
DocumentRoot /home/myuser/domains/mysite.com/public_html
ScriptAlias /cgi-bin/ /home/myuser/domains/mysite.com/public_html/cgi-bin/

etc etc.

So its right there.

The ip phpinfo(); is wrong as i mentioned before (SERVER_ADDR) can it be something with that?
 
After some help and research i found that the issue was that :
/etc/httpd/conf/ips.conf
NameVirtualHost MYIP:80
Needed to be changed to :
NameVirtualHost *:80

My only problem now is that every time i add a new user / domain it resets the ips.conf file so i have to edit it back to :
NameVirtualHost *:80

Can i disable the ips.conf update in some way?

Thanks
 
Why do you want it on *:80. That is uncalled for. What are you trying to do.
 
Why do you want it on *:80. That is uncalled for. What are you trying to do.

Because my server has two ip-adresses, because it is a amazon ec2 server. No websites work if i dont change it to *:80.

Is it hard to prevent ips.conf from being changed?

Thanks for helping me :).
 
Run

Code:
chattr +i /etc/httpd/conf/ips.conf

to make it protected from being overwritten.

Did not find the edit button for posts :/.

You solution worked!
Thank you.

My only problem now is that is you try to access the server on a non existing domain it goes to the first created account/site on the server. Which is kinda wierd.
 
Did you empty the file? No, no you should not do that. You should add there the real IPs which you have on your server. Otherwise you get what you've got now, when saying:

My only problem now is that is you try to access the server on a non existing domain it goes to the first created account/site on the server. Which is kinda wierd.
 
Did you empty the file? No, no you should not do that. You should add there the real IPs which you have on your server. Otherwise you get what you've got now, when saying:


No, i did not empty the file. I have this in my ips. I also tried with my public ip without any success. This is the only one that works with the *:80 . I can load existing sites, but sites that does not exist goes to the first one that was created.

For some reason i think that php also have some issues with this setup, because sessions randomly gets unset.


Code:
# Auto generated apache config file by DirectAdmin version 1.42.1
# Modifying this file is not recommended as any changes you make will be
# overwritten when you add/remove ip's through DirectAdmin.

LogFormat "%O \"%r\"" homedir
NameVirtualHost *:80
 
Back
Top