Can't get second domain to work.

I have a fully functioning domain (ubuntu 10.04) and I've set up a second domain following the exact same instructions (http://library.linode.com/hosting-website). They are both located in the public directory: /home/myusername/public/domainslivehere. And they each have the same file structure (backup, log, public).

The second domain returns an internal server error when checking it via IP (I've modified my local machine hosts file so that when I go to the second domain in my browser it should use the linode IP). Putting the IP address alone in the browser takes me to my first functioning site. I think I'm very close, but missing a step somehow. a2ensite says it's active. I'm sure the ownership is correct.

Any help would be greatly appreciated.

5 Replies

Just a guess based on no real configuration information provided….

You don't have your virtual hosts configurations setup correctly.

When using a virtual host like in the guide, you really can't use just an IP to use in the browser to go to one or the other since they are normally tied to the same IP.

You have to use the hostname you have defined in the configuration file and have those hostnames bound to the same IP.

 <virtualhost *:80=""># Admin email, Server Name (domain name), and any aliases
  ServerAdmin webmaster@example.com
  ServerName  www.example.com   <===============
  ServerAlias example.com       <=============== If there is an alias 

  DocumentRoot /home/example_user/public/example.com/public

  ErrorLog  /home/example_user/public/example.com/log/error.log
  CustomLog /home/example_user/public/example.com/log/access.log combined</virtualhost> 

ServerName for each section needs to be the hostname you want for that virtual host. If it has an alias, you would have that as well. The example above shows that there is a www and non-www address

Document root would point to the location of where the web files are for that virtual host.

Logs would be for that virtual host.

You would have a VirtualHost section for each virtual host you want to host.

As for the error … ???? you have not provided any clue as to what it said, what is in the logfiles etc… so it is hard to figure out what is going on.

Thank you Dweeber!

Sorry about the lack of info. I'll spell it all out as much as I can.

My site.net /etc/apache2/sites-available/site.net (the one that works) looks like:

> # domain: site.net

public: /home/myusername/public/site.net/

# Admin email, Server Name (domain name), and any aliases

ServerAdmin lagi@site.net

ServerName http://www.site.net

ServerAlias site.net

Index file and Document Root (where the public files are located)

DirectoryIndex index.html index.php

DocumentRoot /home/myusername/public/site.net/public

Log file locations

LogLevel warn

ErrorLog /home/myusername/public/site.net/log/error.log

CustomLog /home/myusername/public/site.net/log/access.log combined

My site.org /etc/apache2/sites-available/site.org (the one that doesn't work) looks like:

> # domain: site2.org

public: /home/myusername/public/site2.org/

# Admin email, Server Name (domain name), and any aliases

ServerAdmin lagi@site2.org

ServerName http://www.site2.org

ServerAlias site2.org

Index file and Document Root (where the public files are located)

DirectoryIndex index.html index.php

DocumentRoot /home/myusername/public/site2.org/public

Log file locations

LogLevel warn

ErrorLog /home/myusername/public/site2.org/log/error.log

CustomLog /home/myusername/public/site2.org/log/access.log combined

/etc/apache2/sites-enabled shows shortcuts to both domains.

error.log in site2.org shows:

> [Thu Jun 14 06:47:05 2012] [alert] [client 173.255.175.181] /home/myusername/public/site2.org/public/.htaccess: Invalid command 'Action', perhaps misspelled or defined by a module not included in the server configuration, referer: http://site2.org/

[Thu Jun 14 06:47:59 2012] [alert] [client 173.255.175.181] /home/myusername/public/site2.org/public/.htaccess: Invalid command 'Action', perhaps misspelled or defined by a module not included in the server configuration

[Thu Jun 14 07:10:45 2012] [alert] [client 173.255.175.181] /home/myusername/public/site2.org/public/.htaccess: Invalid command 'Action', perhaps misspelled or defined by a module not included in the server configuration

[Thu Jun 14 07:24:58 2012] [alert] [client 173.255.175.181] /home/myusername/public/site2.org/public/.htaccess: Invalid command 'Action', perhaps misspelled or defined by a module not included in the server configuration, referer: http://184.173.197.229/~lagi/site2.org/

[Thu Jun 14 07:24:59 2012] [alert] [client 173.255.175.181] /home/myusername/public/site2.org/public/.htaccess: Invalid command 'Action', perhaps misspelled or defined by a module not included in the server configuration, referer: http://184.173.197.229/~lagi/site2.org/

[Thu Jun 14 07:25:13 2012] [alert] [client 173.255.175.181] /home/myusername/public/site2.org/public/.htaccess: Invalid command 'Action', perhaps misspelled or defined by a module not included in the server configuration, referer: http://184.173.197.229/~lagi/site2.org/testing.html

I realize that most of the errors are from when I was making stupid attempts to reach the second site via IP without modifying hosts file on local machine. My latest errors are not even showing up in the log. All I get after changing hosts file is Internal Server Error page, I think 404.

it was .htaccess error! Sorry. I was being very dense.

This is wrong…

ServerName http://www.site1.org
ServerAlias site1.org

ServerName http://www.site2.org
ServerAlias site2.org

Your ServerName should be without the http:// part, just the hostname. so

ServerName www.site1.org
ServerAlias site1.org

ServerName www.site2.org
ServerAlias site2.org

Good you figured it out.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct