Trying to host 2 or more domains in a single aws ec2 instance.

my configuration is:

host: [my domain]


Listen 80

<Directory />
AllowOverride none
Require all granted

#Virtual hosts

Include etc/extra/httpd-vhosts.conf


#since XAMPP 1.4.3 AllowOverride AuthConfig Limit Order allow,deny Require all granted Allow from all


<VirtualHost *:80>
ServerAdmin webmaster@[IPv4 Public IP]
DocumentRoot "/opt/lampp/htdocs/rustikhaws/public_html/"
ServerName [IPv4 Public IP]

This configuration gives me...

Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

and I don't know what is lacking in my configuration.

Please help me. Thanks a lot!


(Assuming a single IP address and 2 sites, both on port 80, which is the most typical setup for http multi hosting)

The ServerName needs to be the domain name, not the IP address, and you need a VirtualHost section for each domain name.

You don't specify IP address anywhere in the config ( the *:80 in the VirtualHost line answers on all IPs). You specify the domain -> IP address mapping in DNS, which is outside Apache. For testing purposes you can modify the hosts file on the computer you are testing from.

(This works because the HTTP protocol does not rely on IP address - when a connection is opened to the server, one of the headers the client sends is the host (domain) name it wants information for.

  • Thanks davidgo ! helps a lot.
    – connorliam
    Mar 30 '20 at 1:01

You would need to create individual .conf files in the /sites-available/ directory.

If you could post your full sites-enabled config it would be easier to read.

VirtualHost *:80>
    ServerAdmin admin@example.com
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/example.com/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

Additionally in your httpd.conf you have specified AllowOverride none if you're hosting Wordpress websites and using permalinks you this setting should be AllowOverride all

The error you're receiving is because the URL was not found on the server.

try to enable the site using a2ensite example.com within the sites-available directory. This command will create the symbolic links. In a similar fashion a2dissite will disable the website by removing the symbolic link.

Post your full config and I can help you more

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.