How do I configure apache for a new domain?

Linode Staff

I have created a new domain on our Linode running Ubuntu 19.04 and Apache.

It automatically created new A record and other records by default. I have also changed the nameservers to linode in my registered domain in godaddy to point this linode. Now when I try to access the domain, I see the following:

This page isn?t working example1.com is currently unable to handle this request.
HTTP ERROR 500

/var/www/html/example1.com is this path we have the files for this domain. So when we try to access the home page it should show the index page of this path. How to do this I mean how to map this path to the domain? Why it is showing HTTP Error 500?

1 Reply

A HTTP ERROR 500, or internal server error, typically means there is a misconfiguration within the Apache server. I would start by taking a look at the Apache logs, which are usually in /var/log/apache2/error.log

The following command will show the last 40 error messages:

tail -40 /var/log/apache2/error.log

In order to map a domain to its path, you'll want to make use of Apache2 VirtualHosts. Essentially, you'll want to create /etc/apache2/sites-available/example1.conf

with the following:

ServerName example1.com 
DocumentRoot /var/www/html/example1.com

where servername matches your domain, and DocumentRoot matches the path to your files.

Our Set Up Apache to Run Multiple WordPress Sites guide mentions Wordpress, the Virtual Host configuration instructions are exactly what you are looking for, and include instructions for enabling this site. If you ever want to add another site, you'd simply add another VirtualHost.

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