在ubuntu 下的学习apache2.2 的经历。

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
silegon
帖子: 16
注册时间: 2007-12-14 20:16
来自: xiangtan hunan china
联系:

在ubuntu 下的学习apache2.2 的经历。

#1

帖子 silegon » 2009-07-16 14:36

操作系统为 ubuntu 9.04
因为学习django框架想要架设个发布服务器,到今天为止费了很多周折,当然也学到很多。
有几点希望入门的同学们注意下。
1.apache2 的配置文档在 ubuntu/debian下比较特殊,是被分为几片了。文档到处都有提示,不先看文档会被搞死。强烈推荐看
/usr/share/doc/apache2.2-common/README.Debian.gz
2.在网上瞎逛了N圈之后发现连个简单的虚拟服务器都架设不了。后来发现学习调试测试服务器时要把/etc/hosts 设置下
3.这几天在网上看到的不少不错的资源。
Apache HTTP Server Version 2.2 文档 [最后更新:2009年6月8日](中文版)金步国
http://lamp.linux.gov.cn/Apache/ApacheMenu/index.html
apache2 安装与配置——本文档主要介绍讲述在 Debian系统下有关apache2的一些基本信息及相关配置.
http://book.opensourceproject.org.cn/sy ... .html#toc5
Ubuntu下设置常见网络服务指南
viewtopic.php?f=54&t=1949

最后请教个问题,为什么/etc/apache2/ports.conf中

代码: 全选

NameVirtualHost *:80
Listen 80
的NameVitrualHost *:80 参数可有可无,而且删掉的时候服务器就完全正常了。
同时。
/etc/apache2/sites-available/default 中必须加呢?
silegon
帖子: 16
注册时间: 2007-12-14 20:16
来自: xiangtan hunan china
联系:

Re: 在ubuntu 下的学习apache2.2 的经历。

#2

帖子 silegon » 2009-07-16 14:40

希望有
Ubuntu+Apache2+mos_wsgi+PostgreSQL+django相关经历的能指条路。
头像
Stupid kid
帖子: 416
注册时间: 2006-10-18 12:57

Re: 在ubuntu 下的学习apache2.2 的经历。

#3

帖子 Stupid kid » 2009-07-16 17:51

的NameVitrualHost *:80 参数可有可无,而且删掉的时候服务器就完全正常了。
同时。
/etc/apache2/sites-available/default 中必须加呢?
你看看apache2.conf,其实各个文件也都被include 到apache2.conf里的,所以,先观察下文件结构,会有帮助的

另外,上面的这个问题,我觉得并不是你说的这样,NameVirtualHost这个命令的位置比较随便,当然上下文得对;

多看看http://localhost/manual吧……最好能有实际的需求让你练手……

呵呵,我也学apache2不久,又问题大家多多交流 :em11
http://twitter.com/nothining
Mail: bjdfzster@gmail.com
南京的开源活动几乎是0,希望能有人组织下(也可以拉我入伙^_^)
最近在从零开始学习Linux程序设计,加油……
silegon
帖子: 16
注册时间: 2007-12-14 20:16
来自: xiangtan hunan china
联系:

Re: 在ubuntu 下的学习apache2.2 的经历。

#4

帖子 silegon » 2009-07-17 10:23

谢谢楼上的!
又有新问题了,麻烦了。
django:1.02
apache2:2.2.11
mod-wsgi:2.5
django的admin在测试服务器下打开没问题,部署到apache上后,打开http://www.django.com/blog/ 没问题,打开http://www.django.com/admin/有问题
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, silegon@gmail.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
Apache/2.2.11 (Ubuntu) mod_wsgi/2.5 Python/2.6.2 Server at http://www.django.com Port 80
我的项目位置:/home/administrator/test/mysite
相关文件:
/etc/hosts
administrator@ubuntu:/etc/apache2/sites-available$ cat /etc/hosts
127.0.0.1 localhost
127.0.0.1 http://www.django.com
127.0.0.1 edunuke.firehare.com http://www.firehare.com
127.0.1.1 ubuntu.ubuntu-domain ubuntu

代码: 全选

administrator@ubuntu:/etc/apache2/sites-available$ cat django
NameVirtualHost *:80
<VirtualHost *:80>

    ServerName www.django.com
    ServerAdmin silegon@gmail.com
    
    WSGIDaemonProcess domain display-name=%{GROUP} maximum-requests=10000
    WSGIProcessGroup domain


    WSGIScriptAlias / /home/administrator/test/mysite/wsgi/mod.wsgi


    Alias /media/ "/home/administrator/test/mysite/media/"
    <Directory /home/administrator/test/mysite/>
        Order deny,allow
        Allow from all
    </Directory>

    ErrorLog "/var/log/apache2/django_errors.log"
    CustomLog "/var/log/apache2/django_accesses.log" common   
</VirtualHost>

代码: 全选

administrator@ubuntu:/etc/apache2$ cat ports.conf

Listen 80

代码: 全选

administrator@ubuntu:~/test/mysite$ pwd
/home/administrator/test/mysite
administrator@ubuntu:~/test/mysite$ cat urls.py
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    (r'^admin/(.*)', admin.site.root),
    url(r'^blog/',include('mysite.blog.urls')),
)

代码: 全选

administrator@ubuntu:~/test/mysite/wsgi$ cat mod.wsgi
import os,sys
sys.path.append('/home/administrator/test')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
回复