virtual domains ubuntu www. pointing to wrong server folder!!

October 16, 2013 2.6k views
Hi, not sure if this has happened to anyone but I have 2 droplets one works the other is doing something strange. When I go on my browser and type www.mydomain.com the browser is pointed to var/www/ But when I type in mydomain.com my browser shows the site which sits in var/www/mydomain.com/ in the folder is a Wordpress run site. I have these DNS settings: www CNAME @ * CNAME @ I also have the virtual domains .../apache2/sites-available/mydomain.com ServerAdmin webmaster@localhost ServerName mydomain.com ServerAlias www.mydomain.com DocumentRoot /var/www/mydomain.com/ ..... I just can't work out where the problem lies, does anyone have any ideas? Thanks
9 Answers
Are you trying to associate both droplets with the same domain, i.e. mydomain.com?

Also, do you have the Apache re-write module activated?
Hi, no they are different domain names on both droplets but the settings are the same with different domain names in the files obviously.

My module rewrite is also active!! just seems dead strange its pointing to sub level folder on www

Thanks for your input
In what directory is your .htaccess file saved? Can you post the contents? Are you running WordPress Multisite?
its individual Wordpress setup and each has a .htaccess in the same directory as the wordpress:

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

What's the output of ls -la /var/www
Hi I'm not sure what happened but all of a sudden its just working!!! do you think it had to do with the propagate time? Just it was about a week!!!

here we're my results...

total 20
drwxr-xr-x 4 root root 4096 Oct 15 11:05 .
drwxr-xr-x 12 root root 4096 Oct 15 09:52 ..
drwxr-xr-x 2 root root 4096 Oct 15 11:05 cmdv.org
-rwxr-xr-x 1 www-data www-data 177 Oct 15 09:52 index.html
drwxrwxrwx 9 root root 4096 Oct 15 11:55 s0re.com
"... all of a sudden its just working!!!"


Also, looks like you need to execute sudo chown -R www-data:www-data /var/www
ah ok so I haven't given ownership for that folder to my user?

how would it show up on the file if it did? well I guess I will see when I do it haha

Thanks for the help though, just trying to learn the server side scripting can be very confusing on the first off.
"how would it show up on the file if it did?"

All the referenced to root root in your previous post should/would be www-data www-data
Have another answer? Share your knowledge.