Question

Apache2 Restart Problem

So everytime i type “service apache2 restart” into putty, i get an error

apache2: Syntax error on line 268 of /etc/apache2/apache2.conf: Syntax error on line 30 of /etc/apache2/sites-enabled/000-default: Expected </Directory> but saw </VirtualHost> Action ‘configtest’ failed. The Apache error log may have more information. can anyone help me?

Show comments

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Hi @k0ala Can you post the file here /etc/apache2/sites-enabled/000-default ?

sorry for leaving @hansen, I was really tired and i went to bed… anyway

the site isn’t working and even after doing everything you said and then typing “service apache2 restart” it still said waiting, and I’m following a tutorial that requires you to type that command in order for the website to work… or else you get a 404 error and that’s exactly what’s happenening so no the site doesn’t work :/

@k0ala Just starting a new thread, since it was getting a little narrow.

My guess would be that this is your problem:

        <Directory />
                Options FollowSymLinks
                AllowOverride None      </Directory>

Which should look like this:

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>

But I don’t understand why it says line 30 in the error, when this is clearly not line 30. Anyways, let’s edit the file with this command to make it look like the above:

nano /etc/apache2/sites-enabled/000-default

When you are done editing, hold CTRL key and press X key, release keys, press Y key and press Enter key.

Now restart Apache service apache2 restart.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.