让Apache在局域网上提供服务

我在大学连接到局域网,IP地址为172.16.123.12 。 我试图在Apache服务器上部署一个瓶子应用程序,以便整个校园都能看到这个网站。 我已经使用mod_wsgi成功部署了应用程序,但无法在局域网上工作。 它在localhost/flask上正常工作,但我不能访问http://127.0.1.1/flaskhttp://172.16.123.12/flask上的网站,但是“It works”apache页面可以从http://127.0.1.1http://172.16.123.12

这里是我的虚拟主机conf的烧瓶网站 –

 <VirtualHost *:80> ServerName localhost WSGIDaemonProcess flask_test threads=5 WSGIScriptAlias /flask /var/www/flask_test/flask.wsgi ErrorLog "/var/www/flask_test/error.log" CustomLog "/var/www/flask_test/access.log" combined <Directory /var/www/flask_test> WSGIProcessGroup flask_test WSGIApplicationGroup %{GLOBAL} Order deny,allow Allow from all </Directory> </VirtualHost> 

主机文件:

 127.0.0.1 localhost 127.0.1.1 Linux 

我试图改变我的ipaddress ServerName,但无济于事。 有人能让我知道我要去哪里吗? 万分感谢!

从apapch2ctl -S输出

 /usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not permitted) apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: *:80 is a NameVirtualHost default server 127.0.1.1 (/etc/apache2/sites-enabled/000-default:1) port 80 namevhost 127.0.1.1 (/etc/apache2/sites-enabled/000-default:1) port 80 namevhost Linux (/etc/apache2/sites-enabled/flasktest:1) Syntax OK 

ServerName localhost意味着您的应用程序只有在通过localhost域请求时才可以访问。

删除ServerName行并将您的configuration移动到VirtualHost部分的外部,然后重试。

  • /etc/httpd/conf.d/flask.conf (基于Red Hat)
  • /etc/apache2/conf.d/flask.conf (基于Debian)

     WSGIDaemonProcess flask_test threads=5 WSGIScriptAlias /flask /var/www/flask_test/flask.wsgi <Directory /var/www/flask_test> WSGIProcessGroup flask_test WSGIApplicationGroup %{GLOBAL} Order deny,allow Allow from all </Directory>