Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在debian上使用apache创建子域;第二步创建hgweb子域_Apache_Mercurial_Subdomain_Hgweb - Fatal编程技术网

在debian上使用apache创建子域;第二步创建hgweb子域

在debian上使用apache创建子域;第二步创建hgweb子域,apache,mercurial,subdomain,hgweb,Apache,Mercurial,Subdomain,Hgweb,在我的专用根服务器上尝试设置子域数小时后,我请求您的帮助 目标: 能够创建和访问子域 使用hgweb为mercurial存储库设置自己的子域 有关服务器的信息: Debian Linux内核2.6.32-028stab094.3 Apache/2.2.16(Debian) Mercurial 1.6.4 已安装libapache2-mod-wsgi-py3 第一个问题:我的apache配置有什么问题,我无法通过浏览器访问我的子域? 实际上,我可以访问根域和安装在那里的站点 我的配置: /

在我的专用根服务器上尝试设置子域数小时后,我请求您的帮助

目标:

  • 能够创建和访问子域
  • 使用hgweb为mercurial存储库设置自己的子域
有关服务器的信息:

  • Debian Linux内核2.6.32-028stab094.3
  • Apache/2.2.16(Debian)
  • Mercurial 1.6.4
  • 已安装libapache2-mod-wsgi-py3
第一个问题:我的apache配置有什么问题,我无法通过浏览器访问我的子域?

实际上,我可以访问根域和安装在那里的站点

我的配置: /etc/apache2/sites available/default

<VirtualHost *>
    ServerAdmin webmaster@localhost
    ServerName mydomain.tld
    ServerAlias www.mydomain.tld

    DocumentRoot /var/www/forum
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/forum>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>
</VirtualHost>
我同时使用了,
/etc/init.d/apache2 reload
/etc/init.d/apache2 restart
。Apache没有告诉我我试图加载一个格式错误的配置

根域的站点位于
/var/www/forum
下,可以访问

/var/www/hgrepos的我的文件夹结构如下所示:

hgrepos
+- drwxr-xr-x www-data www-data cgi-bin
|--- -rwxr-xr-x www-data www-data hgweb.config
|--- -rwxr-xr-x www-data www-data hgweb.wsgi
+-- drwxr-xr-x htdocs
|--- -rw-r--r-- www-data www-data index.html
|--- drwxr-xr-x www-data www-data myFirstHgRep
index.html
文件只包含一些Hello World!查看子域是否可访问

现在回到我的第一个问题:为什么我不能通过浏览器访问hgrepos子域

其次,我想使用
hgweb
为我的私人项目提供一些mercurial(hg)存储库。我遵循这些指示:

以下是我在/var/www/hgrepos/cgi-bin/下的配置文件:

hgweb.wsgi

#!/usr/bin/env python
#
# An example hgweb CGI script, edit as necessary
# See also https://www.mercurial-scm.org/wiki/PublishingRepositories

# Path to repo or hgweb config to serve (see 'hg help hgweb')
# config = "hgweb.config"

# Uncomment and adjust if Mercurial is not installed system-wide:
#import sys; sys.path.insert(0, "/path/to/python/lib")

# Uncomment to send python tracebacks to the browser if an error occurs:
import cgitb; cgitb.enable()

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb("hgweb.config")
#wsgicgi.launch(application)
hgweb.config

[web]
style = coal
baseurl =

[paths]
/ = /var/www/hgrepos/htdocs/*
文件的权限:

regine@diddi:/var/www/hgrepos/cgi-bin# ll 
-rwxr-xr-x 1 www-data www-data  68 Nov 17 01:16 hgweb.config
-rwxr-xr-x 1 www-data www-data 621 Nov 17 01:24 hgweb.wsgi
那么现在我的第二个问题是:如何让hgweb工作?我的配置到底出了什么问题?


哦,哇,这是很多文本,但我不太确定哪些信息是需要的,哪些不是。希望你能帮助我,任何提示都是有用的:)

好消息-我解决了我的问题

第一步是删除libapache-mod-wsgi-py3并安装libapache-mod-wsgi(在我的尝试中,我多次重新安装了wsgi-py3-package,似乎我上次的重新安装修复了这个问题……)

之后,重新启动apache在我的error.log中得到了以下信息:

mod_wsgi (pid=16349): Target WSGI script '/var/www/hgrepos/cgi-bin/hgweb.wsgi' cannot be loaded as Python module.
mod_wsgi (pid=16349): Exception occurred processing WSGI script '/var/www/hgrepos/cgi-bin/hgweb.wsgi'.
Traceback (most recent call last):
  File "/var/www/hgrepos/cgi-bin/hgweb.wsgi", line 20, in <module>
    application = hgweb("/var/www/hgrepos/cgi-bin/hgweb.config")
  File "/usr/lib/pymodules/python2.6/mercurial/hgweb/hgweb_mod.py", line 32, in __init__
    self.repo = hg.repository(u, repo)
  File "/usr/lib/pymodules/python2.6/mercurial/hg.py", line 94, in repository
    repo = _lookup(path).instance(ui, path, create)
  File "/usr/lib/pymodules/python2.6/mercurial/bundlerepo.py", line 305, in instance
    return bundlerepository(ui, repopath, bundlename)
  File "/usr/lib/pymodules/python2.6/mercurial/bundlerepo.py", line 177, in __init__
    raise util.Abort(_("%s: not a Mercurial bundle file") % bundlename)
Abort: /var/www/hgrepos/cgi-bin/hgweb.config: not a Mercurial bundle file
重新启动Apache

/etc/init.d/apache2 restart
现在一切都对我有利


再次感谢krtek,他真的帮助我结束了痛苦!让我开心:好消息,我解决了我的问题

第一步是删除libapache-mod-wsgi-py3并安装libapache-mod-wsgi(在我的尝试中,我多次重新安装了wsgi-py3-package,似乎我上次的重新安装修复了这个问题……)

之后,重新启动apache在我的error.log中得到了以下信息:

mod_wsgi (pid=16349): Target WSGI script '/var/www/hgrepos/cgi-bin/hgweb.wsgi' cannot be loaded as Python module.
mod_wsgi (pid=16349): Exception occurred processing WSGI script '/var/www/hgrepos/cgi-bin/hgweb.wsgi'.
Traceback (most recent call last):
  File "/var/www/hgrepos/cgi-bin/hgweb.wsgi", line 20, in <module>
    application = hgweb("/var/www/hgrepos/cgi-bin/hgweb.config")
  File "/usr/lib/pymodules/python2.6/mercurial/hgweb/hgweb_mod.py", line 32, in __init__
    self.repo = hg.repository(u, repo)
  File "/usr/lib/pymodules/python2.6/mercurial/hg.py", line 94, in repository
    repo = _lookup(path).instance(ui, path, create)
  File "/usr/lib/pymodules/python2.6/mercurial/bundlerepo.py", line 305, in instance
    return bundlerepository(ui, repopath, bundlename)
  File "/usr/lib/pymodules/python2.6/mercurial/bundlerepo.py", line 177, in __init__
    raise util.Abort(_("%s: not a Mercurial bundle file") % bundlename)
Abort: /var/www/hgrepos/cgi-bin/hgweb.config: not a Mercurial bundle file
重新启动Apache

/etc/init.d/apache2 restart
现在一切都对我有利


再次感谢krtek,他真的帮助我结束了痛苦!make my day:D

我没有时间完整地查看配置,但是有一个简单的问题,关于子域的DNS解析呢?您的DNS服务器是否配置为响应有关您的子域的请求?噢,您是对的,谢谢您的提示。至少这是丢失的,我会通知你,如果这解决了问题,tooThank you krtek,这至少解决了我的第一个问题-我不能访问我的子域!太好了,谢谢!现在我需要修复hgweb的东西…很高兴我能帮上忙。。。如果我今天有时间的话,我会试着看看你的配置问题。嘿,krtek,那太好了。我现在正在处理它,但是我仍然得到一个500的内部服务器错误。我将查看日志并重试一点,我会在有消息后立即更新您。我没有时间完整查看配置,但有一个简单的问题,关于子域的DNS解析如何?您的DNS服务器是否配置为响应有关您的子域的请求?噢,您是对的,谢谢您的提示。至少这是丢失的,我会通知你,如果这解决了问题,tooThank you krtek,这至少解决了我的第一个问题-我不能访问我的子域!太好了,谢谢!现在我需要修复hgweb的东西…很高兴我能帮上忙。。。如果我今天有时间的话,我会试着看看你的配置问题。嘿,krtek,那太好了。我现在正在处理它,但是我仍然得到一个500的内部服务器错误。我将查看日志并重试一点,我将在有消息后立即向您更新。
#!/usr/bin/env python
#

# Uncomment and adjust if Mercurial is not installed system-wide:
#import sys; sys.path.insert(0, "/usr/lib/pymodules/python2.6")

# Uncomment to send python tracebacks to the browser if an error occurs:
import cgitb; cgitb.enable()

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi

# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "/var/www/hgrepos/cgi-bin/hgweb.config"
application = hgweb(config)
/etc/init.d/apache2 restart