Can't get second domain to work.
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
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.
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:
[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
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.