503 error on apache virtual hosts

I created a virtual host with the following code on an ubuntu apache server

cd /var/www/
sudo mkdir fd-pro
sudo mkdir /var/www/fd-pro/ch-api
sudo mkdir /var/www/fd-pro/ch-api/public_html
sudo chown -R $USER:$USER /var/www/fd-pro/ch-api/public_html
sudo chmod -R 755 /var/www/*
nano /var/www/fd-pro/ch-api/public_html/index.html

And created index.html

Then

sudo nano /etc/apache2/sites-available/domain.mydomain.com.au.conf

<VirtualHost *:80>
    DocumentRoot /var/www/fd-pro/ch-api/public_html
    ServerName domain.mydomain.com.au
    ServerAlias domain.mydomain.com.au

    <Directory /var/www/fd-pro/ch-api/public_html>
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/domain-error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/domain-access.log combined
</VirtualHost>

sudo a2ensite domain.mydomain.com.au.conf

sudo service apache2 restart

No errors were displayed, but sever responds with 503 error. Can anyone help me?


Solution 1:

Require all granted

is valid for apache 2.4.

The equivalent for apache 2.2 is:

Allow from all

Solution 2:

No errors were displayed, but sever responds with 503 error. Can anyone help me?

Yes, go and look in you apache error log, which should be located in /var/log/apache2/.

The error log should contain more detailed information about what the problem is. You should use that to diagnose what the problem is. google (other search engines are available) will be helpful too once you have found the problem in your logs.

Solution 3:

Problem is mod headers is not enabled in apache.