Report this

What is the reason for this report?

deploying django app with apache2

Posted on August 25, 2017

● apache2.service - LSB: Apache2 web server Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled) Drop-In: /lib/systemd/system/apache2.service.d └─apache2-systemd.conf Active: failed (Result: exit-code) since Fri 2017-08-25 09:41:31 MST; 39min ago Docs: man:systemd-sysv-generator(8) Process: 6874 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS) Process: 6836 ExecReload=/etc/init.d/apache2 reload (code=exited, status=1/FAILURE) Process: 6943 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Aug 25 09:41:31 s166-62-39-74.secureserver.net apache2[6943]: * Starting Apache httpd web server apache2 Aug 25 09:41:31 s166-62-39-74.secureserver.net apache2[6943]: * Aug 25 09:41:31 s166-62-39-74.secureserver.net apache2[6943]: * The apache2 configtest failed. Aug 25 09:41:31 s166-62-39-74.secureserver.net apache2[6943]: Output of config test was: Aug 25 09:41:31 s166-62-39-74.secureserver.net apache2[6943]: AH00112: Warning: DocumentRoot [/var/www/fancyfishandveggie.com/public_html] does not ex Aug 25 09:41:31 s166-62-39-74.secureserver.net apache2[6943]: [Fri Aug 25 09:41:31.380948 2017] [core:error] [pid 6952:tid 139897597433728] (EAI 2)Nam Aug 25 09:41:31 s166-62-39-74.secureserver.net apache2[6943]: AH00526: Syntax error on line 5 of /etc/apache2/sites-enabled/singlepoint.conf: Aug 25 09:41:31 s166-62-39-74.secureserver.net apache2[6943]: Alias takes two arguments, a fakename and a realname Aug 25 09:41:31 s166-62-39-74.secureserver.net apache2[6943]: Action ‘configtest’ failed. Aug 25 09:41:31 s166-62-39-74.secureserver.net apache2[6943]: The Apache error log may have more information.

here is the file:

<VirtualHost *.80> WSGIScriptAlias / /var/www/singlepoint/singlepoint.wsgi ServerName singlepointfarmer.com Alias /static /var/www/singlepoint/static/ <Directory /var/www/singlepoint/> Order allow, deny Allow from all </Directory> </VirtualHost>

What is wrong here ?



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!

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.

Solved that. Now trying to deploy django app singlepoint on singlipointfarmer.com

<VirtualHost 166.62.39.74:80> ServerName singlepointfarmer.com ServerAlias www.singlepointfarmer.com ServerAdmin tcsams@gmail.com Alias /static /var/www/singlepoint/static <Directory /var/www/singlepoint/static> Require all granted </Directory>

    <Directory /var/www/singlepoint/singlepoint>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

WSGIDaemonProcess singlepoint  python-path=/var/www/singlepoint
WSGIProcessGroup  singlepoint
WSGIScriptAlias / /var/www/singlepoint/singlepoint/wsgi.py

</VirtualHost>

Result http://www.singlepointfarmer.com Bad Request (400)

Please help - thanks

What is the complete output of /etc/apache2/sites-enabled/singlepoint.conf

Heya,

For anyone that is stumbling upon this, The error log suggests there are issues with your Apache configuration file, particularly related to the Alias directive and possibly the directory structure. Here’s how you can address the problem step by step:

The Alias directive should look like this:

Alias /static /var/www/singlepoint/static

Remove the trailing slash (/) from the second argument unless it’s strictly needed. Having the slash might cause Apache to misinterpret the path.

Corrected configuration snippet:

Alias /static /var/www/singlepoint/static

2. Check for Missing Files or Directories

Another error in the log:

AH00112: Warning: DocumentRoot [/var/www/fancyfishandveggie.com/public_html] does not exist

This indicates that the specified DocumentRoot in another configuration file does not exist. Ensure all directories referenced in your Apache configuration actually exist.

Fix:

Run the following commands to verify:

ls -ld /var/www/singlepoint/static
ls -ld /var/www/singlepoint/

If the paths do not exist, create them:

sudo mkdir -p /var/www/singlepoint/static
sudo mkdir -p /var/www/singlepoint
  • Ensure proper ownership and permissions:
sudo chown -R www-data:www-data /var/www/singlepoint
sudo chmod -R 755 /var/www/singlepoint
  1. Directory Directive Syntax

The Directory directive in your configuration uses older syntax (Order allow, deny). Starting with Apache 2.4, the recommended syntax has changed to Require directives.

Updated Directory Configuration:

<Directory /var/www/singlepoint/>
    Require all granted
</Directory>

4. Validate the Syntax

After making these changes, validate the Apache configuration using:

sudo apache2ctl configtest

If the syntax is correct, you should see:

Syntax OK

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.