我试图在VPS(Ubuntu 16.04.2,Apache2)上部署我的服务器python应用程序,当我写sudo service apache2 reload
时,我收到了这样的错误:apache2.service is not active, cannot reload.
当我想看到我的系统时,我得到了这个。
systemctl status apache2.service
● 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: inactive (dead) since Sat 2017-03-11 19:34:43 UTC; 5min ago
Docs: man:systemd-sysv-generator(8)
Process: 10065 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 9832 ExecReload=/etc/init.d/apache2 reload (code=exited, status=0/SUCCESS)
Process: 10045 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
Mar 11 19:34:42 kristicbot systemd[1]: Starting LSB: Apache2 web server...
Mar 11 19:34:42 kristicbot apache2[10045]: * Starting Apache httpd web server apache2
Mar 11 19:34:43 kristicbot apache2[10045]: Action 'start' failed.
Mar 11 19:34:43 kristicbot apache2[10045]: The Apache error log may have more information.
Mar 11 19:34:43 kristicbot apache2[10045]: *
Mar 11 19:34:43 kristicbot apache2[10065]: * Stopping Apache httpd web server apache2
Mar 11 19:34:43 kristicbot apache2[10065]: *
Mar 11 19:34:43 kristicbot systemd[1]: Started LSB: Apache2 web server.
Mar 11 19:35:00 kristicbot systemd[1]: apache2.service: Unit cannot be reloaded because it is inactive.
在此之前,我在000-default.conf文件中进行了一些更正。我通过以下方式改变了它:
<VirtualHost *:80>
WSGIDaemonProcess botserver
WSGIScriptAlias / /var/www/html/bot/botserver.wsgi
<Directory /var/www/html/bot/>
WSGIProcessGroup botserver
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
我的botserver.py非常简单:
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello {}".format(2+2)
if __name__ == '__main__':
app.run(host='0.0.0.0')
~
我的botserver.wsgi:
import sys
sys.path.insert(0, 'var/www/html/bot')
from botserver import app as application
什么可能导致这个问题,我该如何克服它?