Локально, когда я запускаю свое приложение как «фляговое» приложение, оно работает нормально. На сервере я хочу сделать это как приложение Apache + Mod WSGI.
Я установил Apache2 и python на сервер ubuntu 16.04.
При переходе по ссылке http://192.0.2.1/same_base_parallelograms/?info={}
дает мне ошибку:
Not Found
The requested URL was not found on this server.
Apache/2.4.18 (Ubuntu) Server at 192.0.2.1 Port 80
Содержимое моей машины Ubuntu:
my_machine: /etc/apache2/sites-available$ ls
000-default.conf default-ssl.conf FlaskApp.conf
Мой FlaskApp.conf
выглядит как:
<VirtualHost *:80>
ServerName 192.0.2.1
ServerAdmin webmaster@localhost
WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi
<Directory /var/www/FlaskApp/as-proto/wrappers/qg>
Order allow,deny
Allow from all
</Directory>
Alias /static /var/www/FlaskApp/as-proto/wrappers/static/
<Directory /var/www/FlaskApp/as-proto/wrappers/static/>
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
При выполнении sudo service apache2 restart
my_machine: $ sudo service apache2 restart
my_machine: $ echo $?
0
И мой flaskapp.wsgi
файл выглядит так:
#!/usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0, "/var/www/FlaskApp/as-proto/wrappers")
from qg import app as application
application.secret_key = '\x8fC\xc2\x8b\xaaOj\x95\x1d\x13\xd3\xa8\x89\x17\xecc>\xea\xce\xc2)\x9a\xa2\x9d'
Мой /var/log/apache2/error.log
выглядит как:
[Fri Jul 03 05:55:18.436402 2020] [mpm_event:notice] [pid 29283:tid 140501999363968] AH00491: caught SIGTERM, shutting down
[Fri Jul 03 05:55:18.515806 2020] [mpm_event:notice] [pid 31625:tid 140371040446336] AH00489: Apache/2.4.18 (Ubuntu) mod_wsgi/4.3.0 Python/2.7.12 configured -- resuming normal operations
[Fri Jul 03 05:55:18.515887 2020] [core:notice] [pid 31625:tid 140371040446336] AH00094: Command line: '/usr/sbin/apache2'
[Fri Jul 03 05:55:32.027096 2020] [mpm_event:notice] [pid 31625:tid 140371040446336] AH00491: caught SIGTERM, shutting down
[Fri Jul 03 05:55:32.106480 2020] [mpm_event:notice] [pid 31732:tid 139727201265536] AH00489: Apache/2.4.18 (Ubuntu) mod_wsgi/4.3.0 Python/2.7.12 configured -- resuming normal operations
[Fri Jul 03 05:55:32.106568 2020] [core:notice] [pid 31732:tid 139727201265536] AH00094: Command line: '/usr/sbin/apache2'
[Fri Jul 03 06:01:56.898017 2020] [mpm_event:notice] [pid 31732:tid 139727201265536] AH00491: caught SIGTERM, shutting down
[Fri Jul 03 06:01:56.978572 2020] [mpm_event:notice] [pid 31941:tid 140303713417088] AH00489: Apache/2.4.18 (Ubuntu) mod_wsgi/4.3.0 Python/2.7.12 configured -- resuming normal operations
[Fri Jul 03 06:01:56.978652 2020] [core:notice] [pid 31941:tid 140303713417088] AH00094: Command line: '/usr/sbin/apache2'
[Fri Jul 03 06:03:23.922778 2020] [mpm_event:notice] [pid 31941:tid 140303713417088] AH00491: caught SIGTERM, shutting down
[Fri Jul 03 06:03:24.003181 2020] [mpm_event:notice] [pid 32083:tid 139774188795776] AH00489: Apache/2.4.18 (Ubuntu) mod_wsgi/4.3.0 Python/2.7.12 configured -- resuming normal operations
[Fri Jul 03 06:03:24.003315 2020] [core:notice] [pid 32083:tid 139774188795776] AH00094: Command line: '/usr/sbin/apache2'
Мой /var/log/apache2/access.log
выглядит как:
198.51.100.151 - - [03/Jul/2020:05:55:07 +0000] "GET /three_concurrent_lines/?info={} HTTP/1.1" 404 492 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:77.0) Gecko/20100101 Firefox/77.0"
198.51.100.151 - - [03/Jul/2020:05:56:38 +0000] "GET /triangle_exterior_angle_bisection/?info={} HTTP/1.1" 404 492 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:77.0) Gecko/20100101 Firefox/77.0"
198.51.100.151 - - [03/Jul/2020:06:00:44 +0000] "GET /same_base_parallelograms/?info={} HTTP/1.1" 404 492 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:77.0) Gecko/20100101 Firefox/77.0"
203.0.113.213 - - [03/Jul/2020:06:01:12 +0000] "GET / HTTP/1.1" 200 11576 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"
203.0.113.213 - - [03/Jul/2020:06:01:12 +0000] "GET / HTTP/1.1" 200 11576 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"
198.51.100.151 - - [03/Jul/2020:06:01:59 +0000] "GET /same_base_parallelograms/?info={} HTTP/1.1" 404 492 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:77.0) Gecko/20100101 Firefox/77.0"
198.51.100.151 - - [03/Jul/2020:06:02:00 +0000] "GET /same_base_parallelograms/?info={} HTTP/1.1" 404 491 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:77.0) Gecko/20100101 Firefox/77.0"
Если кто-то может указать мне, где я что-то упустил, это было бы здорово.