Apache:403禁止使用WSGIScriptAlias

我正在尝试按照网站上的这些说明安装istSOS :


安装

安装PostgreSQL

$ sudo apt-get install postgresql postgresql-client postgresql-contrib pgadmin3 

安装PostGIS

 $ sudo apt-get install postgresql-9.1-postgis 

configurationPostgreSQL密码

 $ sudo -u postgres psql > alter user postgres password 'postgres'; 

安装Apache2

 $ sudo apt-get install apache2 

安装mod_wsgi

 $ sudo apt-get install libapache2-mod-wsgi 

安装psycopg2

 $ sudo apt-get install python-psycopg2 

下载istSOS并将其解压到/usr/local/istsos

 $ wget http://istsos.googlecode.com/files/istSOS-2.0.tar.gz 

下载位置实际上已经改变为SourceForge 。

 $ sudo tar -zxvf istSOS-2.0.tar.gz -C /usr/local/ 

设置文件夹serviceslogs执行权限和所有者

 $ sudo chmod 755 -R /usr/local/istsos $ sudo chown -R www-data:www-data /usr/local/istsos/services $ sudo chown -R www-data:www-data /usr/local/istsos/logs 

configurationApacheWSGI

  • 打开/etc/apache2/sites-enabled/000-default.conf并在标记</VirtualHost>之前添加以下行

     WSGIScriptAlias /istsos /usr/local/istsos/application.py Alias /istsos/admin /usr/local/istsos/interface 

重新启动apache2服务器

 $ sudo /etc/init.d/apache2 restart 

检查加载页面的浏览器上的安装是否成功

 http://localhost/istsos/admin 

问题

但是,Web服务器返回Unable to connect
当我尝试http://localhost:8080/istsos/admin而是我收到:

 Not Found The requested URL /istsos/admin was not found on this server. 

寻找答案

正如krisfr所build议的,我试图找出为什么服务器端口8080而不是端口80响应。

 $ apache2ctl -t -D DUMP_VHOSTS VirtualHost configuration: *:80 is a NameVirtualHost default server localhost (/etc/apache2/sites-enabled/000-default.conf:1) port 80 namevhost localhost (/etc/apache2/sites-enabled/000-default.conf:1) port 80 namevhost localhost (/etc/apache2/sites-enabled/000-default.conf:1) 

这似乎没有configuration?


更新

我将Apache / Port问题解压到另一个问题,并得到了一个有用的答案。 然后我configuration服务器来侦听端口80并重新启动服务器。 当我访问http://localhost/istsos/admin我收到以下消息:

被禁止

您无权访问此服务器上的/ istsos / admin。
本地端口80上的Apache / 2.4.6(Ubuntu)服务器

这些文件夹的所有者设置是按照指示说明设置的。 我发现了istSOS的替代安装说明 ,我仍然需要了解,但是我已经想和你分享了。


教程移动!

这个教程有一个新的页面 !

任何你想要访问端口8080上的istsospipe理页面的原因? 在您提供的文档中,我看不到任何对此端口的引用。

在文档中,他们说修改文件/etc/apache2/sites-enabled/000-default.conf 。 该文件是Apache的默认虚拟主机configuration。 它在端口80上configuration。

从现在起,您似乎已经有了一个虚拟主机设置来侦听端口8080 。 因此,请打开此虚拟主机的configuration文件,并执行与默认configuration相同的操作:

在标签</VirtualHost>之前添加以下内容:

 WSGIScriptAlias /istsos /usr/local/istsos/application.py Alias /istsos/admin /usr/local/istsos/interface 

尝试添加path/在界面的结尾。 8080实际上是wsgi应用程序(application.py),80是Apache的前端。

最后,在将问题发布到istSOS邮件列表后,我运行了服务器。 这是米兰回答的重要部分:

这个版本的Ubuntu [13.10]附带了一个更新版本的Apache。 在我的情况下,我解决了以下方式configurationApache和WSGI的问题:

我发布整个configuration文件,以便更容易理解。 这里是我的机器上的/etc/apache2/sites-enabled/000-default.conf的内容:

 <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined WSGIScriptAlias /istsos /usr/local/istsos/application.py Alias /istsos/admin /usr/local/istsos/interface <LocationMatch /istsos> Options +Indexes +FollowSymLinks +MultiViews AllowOverride all Require all granted </LocationMatch> </VirtualHost> 

请记得在更改configuration后重新启动Apache:

 $ sudo service apache2 restart