错误的Apache2启动服务器配置,而蟒蛇 [英] Error in starting apache2 server while configuring for python
问题描述
您好我试图配置的Apache2服务器蟒蛇,我用这个命令来安装Apache2的:
命令和apt-get安装的Apache2
CD的/ etc / apache2的/ MODS启用/
须藤LN -s ../mods-available/mod_python.load mod_python.load
CD的/ etc / apache2的/网站的可用/
须藤gedit中默认
编辑默认的文件为:
<目录/ var / WWW />
选择指数多视图了FollowSymLinks
的AllowOverride AuthConfig
为了允许,拒绝
所有允许 AddHandler的mod_python的的.py
PythonHandler mod_python.publisher
PythonDebug在 #取消该指令是你想看到的Apache2的
#默认启动页面(/ Apache2的默认),当你去/
#RedirectMatch ^ / $ / Apache2的默认/
< /目录>
后来我用这个命令:
须藤/etc/init.d/apache2重启
我得到了一个错误:
*启动Web服务器的apache2 apache2的:在/etc/apache2/apache2.conf中的204行语法错误:上的/ etc / apache2的/启用MODS-/ mod_python的第1行中的语法错误.load:的LoadModule有两个参数,一个模块名称和共享的目标文件,从加载它的名字
当我想看看那是什么在mod_python.load present使用cat命令我得到的链接的LoadModule python_module / usr / lib目录/ apache2的/模块/ mod_python.so
请帮助我。
续..
现在,我得到一个新的错误
主席先生,我已经把具有文件hello.py code
#!的/ usr / bin中/蟒蛇
打印内容类型:text / html的\\ r \\ n \\ r \\ n
打印'< HTML和GT;'
打印'< HEAD>'
打印'<标题>您好字 - 第一个CGI程序< /标题>'
打印'< /头>'
打印'<身体GT;'
打印'< H2>您好字!这是我第一次CGI程序和LT; / H>'
打印'< /身体GT;'
打印'< / HTML>'
在 /无功/网络
一个文件夹,名为cgi-bin目录
当我使用的Apache2上运行此
HTTP://localhost/cgi-bin/hello.py
块引用>我得到这个错误
请求的URL /cgi-bin/hello.py没有在此服务器上找到。
在本地主机端口80的Apache / 2.2.14(Ubuntu的)服务器
解决方案它看起来像有是领先的/和路径模块的其余部分的空间。在那儿?如果是这样,删除空间并再次尝试...
Hello i'm trying to configure apache2 server for python, i used this command to install apache2:
sudo apt-get install apache2 cd /etc/apache2/mods-enabled/ sudo ln -s ../mods-available/mod_python.load mod_python.load cd /etc/apache2/sites-available/ sudo gedit default
edited the default file to:
<Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride AuthConfig Order allow,deny allow from all AddHandler mod_python .py PythonHandler mod_python.publisher PythonDebug On # Uncomment this directive is you want to see apache2's # default start page (in /apache2-default) when you go to / #RedirectMatch ^/$ /apache2-default/ </Directory>
later i used this command:
sudo /etc/init.d/apache2 restart
i got an error:
* Starting web server apache2 apache2: Syntax error on line 204 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/mod_python.load: LoadModule takes two arguments, a module name and the name of a shared object file to load it from
when i tried to see what's the link that's present in mod_python.load using cat command i got
LoadModule python_module / usr/lib/apache2/modules/mod_python.so
please help me out.
Continued.. Now i'm getting a new error Sir, i have placed a file hello.py having code
#!/usr/bin/python print "Content-type:text/html\r\n\r\n" print '<html>' print '<head>' print '<title>Hello Word - First CGI Program</title>' print '</head>' print '<body>' print '<h2>Hello Word! This is my first CGI program</h2>' print '</body>' print '</html>'
in a folder called cgi-bin in
/var/www
when i run this on apache2 usingi'm getting this error
The requested URL /cgi-bin/hello.py was not found on this server. Apache/2.2.14(Ubuntu)Server at localhost Port 80
解决方案It looks like there is a space between the leading / and the rest of the path to the module. Is there? If so, remove the space and try again...
这篇关于错误的Apache2启动服务器配置,而蟒蛇的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!