环境:Ubuntu 16.04.1 + Django  1.11.15 + Apache 2.4.18 + python 3.5

此篇文章内容提到的第几步,对照以下链接中的步骤

  百度云的ubuntu16.04.1部署Apache服务器+Django项目

将项目搭建到云主机上,第四步重启apache报的错

报错信息:

  Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.

  按照提示,使用journalctl -xe打开错误日志

  显示如下:

-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit apache2.service has begun starting up.
Aug 08 10:41:17 instance-4xi7rrkf apache2[10930]: * Starting Apache httpd web server apache2
Aug 08 10:41:17 instance-4xi7rrkf apache2[10930]: *
Aug 08 10:41:17 instance-4xi7rrkf apache2[10930]: * The apache2 configtest failed.
Aug 08 10:41:17 instance-4xi7rrkf apache2[10930]: Output of config test was:
Aug 08 10:41:17 instance-4xi7rrkf apache2[10930]: apache2: Syntax error on line 219 of /etc/apache2/apache
Aug 08 10:41:17 instance-4xi7rrkf apache2[10930]: Action 'configtest' failed.
Aug 08 10:41:17 instance-4xi7rrkf apache2[10930]: The Apache error log may have more information.
Aug 08 10:41:17 instance-4xi7rrkf systemd[1]: apache2.service: Control process exited, code=exited status=
Aug 08 10:41:17 instance-4xi7rrkf systemd[1]: Failed to start LSB: Apache2 web server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit apache2.service has failed.
--
-- The result is failed.
Aug 08 10:41:17 instance-4xi7rrkf systemd[1]: apache2.service: Unit entered failed state.
Aug 08 10:41:17 instance-4xi7rrkf systemd[1]: apache2.service: Failed with result 'exit-code'.
Aug 08 10:41:22 instance-4xi7rrkf sshd[10964]: Connection closed by 5.188.218.246 port 34880 [preauth]

  按照错误提示:说是 /etc/apache2/apache.conf文件的219行配置出错

  打开提示文件,找到第219行:

    (vim显示行号:按下esc键,输入 (:set nu))  

218 # Include the virtual host configurations:
219 IncludeOptional sites-enabled/*.conf

  将219行的配置文件改为:  tip.conf为第二步的网络配置文件名

218 # Include the virtual host configurations:
219 IncludeOptional sites-enabled/tip.conf

这个时候 apache服务就可以重启了

  赶紧打开网站:

  报错如下:

  

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at [no address given] to inform them of the time this error occurred,
and the actions you performed just before this error.
More information about this error may be available in the server error log.
Apache/2.4.18 (Ubuntu) Server at www.py6web.com Port 80

  

查看apache2的错误日志

这个时候切换到 :cd /var/log/apache2

就会发现文件夹下多了两个错误日志文件

root@instance-4xi7rrkf:/var/log/apache2# ls
access.log django-tip-error.log error.log other_vhosts_access.log tip-django.log

打开错误日志,查看错误信息:

[Wed Aug 08 10:49:22.535845 2018] [wsgi:error] [pid 11109:tid 140181583668992] [client 106.121.68.131:64773]     import pymysql
[Wed Aug 08 10:49:22.535881 2018] [wsgi:error] [pid 11109:tid 140181583668992] [client 106.121.68.131:64773] ImportError: No module named 'pymysql'

很明显少了个pymysql模块 使用pip3 install pymysql安装后,网站就可以正常访问了(其他同样信息,也执行此操作,最好切换到root用户下)

切换root用户 :   sudo su

Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.的更多相关文章

  1. Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details

    thinkphp 在Apache上配置启用伪静态,重启Apache1 restart 竟然失败了,报错 Job for httpd.service failed because the control ...

  2. CentOS启动docker1.13失败(Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.)

    一.启动失败 1.启动docker [root@localhost ~]# systemctl start docker Job for docker.service failed because t ...

  3. docker 报错: Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

    centos 启动docker服务报错: Job for docker.service failed because the control process exited with error cod ...

  4. Linux 重启网卡失败 Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.

    linux下重启网卡使用命令 : service network restart 时报错: [root@slave01 hadoop]# service network restart Startin ...

  5. Job for php-fpm.service failed because the control process exited with error code. See "systemctl status php-fpm.service" and "journalctl -xe" for details.

    [root@web01 ~]#  systemctl start php-fpm Job for php-fpm.service failed because the control process ...

  6. Jenkins 安装启动提示“iJob for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.”

    通过RPM安装Jenkins简单方便,不太需要复杂的过程,但是在安装完成以后启动Jenkins的时候提示“Starting jenkins (via systemctl): Job for jenki ...

  7. Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

    一.前言 Job for mysqld.service failed because the control process exited with error code. See "sys ...

  8. Linux系统Docker启动问题Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service"

    在Liunx中使用Docker, 注: Liunx使用的是在虚拟机下的centOS7版本在刚开始安装Docker时没有任何错误, 但是在后续的docker启动过程中, 出现以下问题: [root@zk ...

  9. kali linux重启网卡失败:Job for networking.service failed because the control process exited with error code. See "systemctl status networking.service" and "journalctl -xe" for details. 问题排查

    linux菜鸡的时候,总是为了配置网络而烦恼,重启网卡的原因有很多,我这次是因为配置了固定IP[使用第三方工具连接]所以需要重启网卡,出现 Job for networking.service fai ...

随机推荐

  1. tensorflow 高级api使用分布式之配置

    """Constructor. Sets the properties `cluster_spec`, `is_chief`, `master` (if `None` i ...

  2. 基于docker的wekan部署

    镜像地址: https://hub.docker.com/r/wekanteam/wekan/ wiki: https://github.com/wekan/wekan/wiki#Developmen ...

  3. css 书目录相关css+html代码

    css: <style type="text/css"> #list{width:500px;position:absolute;left:50%;margin-lef ...

  4. Java的学习01

    记录每天的学习情况.加油. /** * 测试包装类 * @author 小白 * */ public class TestWrappedClass { public static void main( ...

  5. JDBC事物的处理

    JDBC事物的处理: 概念:事务是指逻辑上的一组操作,组成这组操作的各个单元,要不全部成功,要不全部不成功. 数据库开启事务命令: start transaction  开启事务 Rollback   ...

  6. Java,JDK动态代理的原理分析

    1. 代理基本概念: 以下是代理概念的百度解释:代理(百度百科) 总之一句话:三个元素,数据--->代理对象--->真实对象:复杂一点的可以理解为五个元素:输入数据--->代理对象- ...

  7. 设置,获取,删除cookie

    function setCookie(key,value,options){ if (value !== undefined ) { if(options === undefined || optio ...

  8. JS的6种常见继承模式

    数天前在知乎看到有人阿里面试被问到这个问题,我来总结一下. 1. 原型链继承: function SuperType() { this.property = true; } SuperType.pro ...

  9. WAS 手动删除server

    有时候WPS Server上的应用会一直start不起来,尝试卸载也会失败.在这种情况下,我们可以手动删除这个文件. 步骤如下: 1. Stop server 2. 进入$Profile_instal ...

  10. Maximum GCD(fgets读入)

    Maximum GCD https://vjudge.net/contest/288520#problem/V Given the N integers, you have to find the m ...