Internal server issue after set up apache 2

Hello, after completing the “how to set up an Apache…” ([link]( , I end up with an 500 internal server issue when doing the last task.

When I’m checking error log it says:

Exec format error: exec of ‘/var/www/test/’ failed: /var/www/test/

Could someone please help me with this problem.

Kind regards!

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Thank you, thats one error less.

Unfortunately now after setting up FlaskApp after this I am still recieving an internal server error. My code is as follows:


activate_this = ‘/var/www/FlaskApp/FlaskApp/venv/bin/’ execfile(activate_this, dict(file=activate_this))


import sys import logging

logging.basicConfig(stream=sys.stderr) sys.path.insert(0,“/var/www/FlaskApp/”)

from FlaskApp import app as application

application.secret_key = ‘xxxx’


<VirtualHost *:80> ServerName ServerAdmin WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi <Directory /var/www/FlaskApp/FlaskApp/> Require all granted </Directory> Alias /static /var/www/FlaskApp/FlaskApp/static <Directory /var/www/FlaskApp/FlaskApp/static/> Require all granted </Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined


Unfortunately I still get this error:

[Wed Dec 06 20:41:25.869637 2017] [wsgi:error] [pid 14713] [client] mod_wsgi (pid=14713): Target WSGI script ‘/var/www/FlaskApp/flaskapp.wsgi’ cannot be loaded as Python module. [Wed Dec 06 20:41:25.869987 2017] [wsgi:error] [pid 14713] [client] mod_wsgi (pid=14713): Exception occurred processing WSGI script ‘/var/www/FlaskApp/flaskapp.wsgi’. [Wed Dec 06 20:41:25.870060 2017] [wsgi:error] [pid 14713] [client] Traceback (most recent call last): [Wed Dec 06 20:41:25.870128 2017] [wsgi:error] [pid 14713] [client] File “/var/www/FlaskApp/flaskapp.wsgi”, line 12, in <module> [Wed Dec 06 20:41:25.870387 2017] [wsgi:error] [pid 14713] [client] from FlaskApp import app as application [Wed Dec 06 20:41:25.870463 2017] [wsgi:error] [pid 14713] [client] ImportError: No module named FlaskApp

If been trying to remove this error all day, but I cant seem to figure it out. How can I work this out?

Kind regards

Apply a “shebang” line, something like

#!/usr/bin/env python

as the first line. Also, make sure the script is executable with chmod.