问题描述
嗨插入表情符号在这里',
Hey guys 'insert smiley here',
在试图我的专用根服务器上设置子域小时,我要问你的帮助。
After hours of trying to setup subdomains on my dedicated root server, I'm asking you for help.
目标:
- 能够创建和访问子域
- 设置一个自己的子域善变库,使用hgweb
有关服务器的信息:
- 的Debian的Linux,内核2.6.32-028stab094.3
- 的Apache / 2.2.16(Debian的)
- 水银1.6.4
- 安装中的libapache2-MOD-WSGI-PY3
第一个问题:什么是错我的Apache的配置,我无法通过浏览器访问我的子域
其实,我可以访问根域和安装在这里的网站。
Actually, I can access the root domain and the sites which are installed there.
我的配置:
的/ etc / apache2的/网站的可用/默认
<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/apache2/sites-available/hgrepos.domainname.tld
<VirtualHost *>
ServerName hgrepos.domainname.tld
ServerAlias www.hgrepos.domainname.tld
DocumentRoot /var/www/hgrepos/htdocs
# WSGIScriptAliasMatch ^(.*)$ /var/www/hgrepos/cgi-bin/hgweb.wsgi$1
WSGIScriptAlias / /var/www/hgrepos/cgi-bin/hgweb.wsgi
# To enable "daemon" mode, uncomment following lines. (Read mod_wsgi docs for more info)
# WSGIDaemonProcess hgrepos.domainname.tld user=USER group=GROUP threads=1 processes=15 maximum-requests=1000
WSGIDaemonProcess hgrepos.domainname.tld threads=1 processes=15 maximum-requests=1000
# some more interesting options (tested on mod_wsgi 2.0):
# umask=0007 display-name=wsgi-hg.example.net inactivity-timeout=300
# WSGIProcessGroup hg.example.net
<Directory /var/www/hgrepos/htdocs>
Options FollowSymlinks
DirectoryIndex index.html
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/hgrepos/cgi-bin>
Options ExecCGI FollowSymlinks
AddHandler wsgi-script .wsgi
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
我的 /etc/apache2/httpd.conf 文件是空的。
我能够经由 a2ensite subdomain.domainname.tld
的子文件。
I enabled the subdomain file via a2ensite subdomain.domainname.tld
.
regine@diddi:/etc/apache2/sites-available# ll ../sites-enabled/
lrwxrwxrwx 1 root root 26 Oct 29 22:33 000-default -> ../sites-available/default
lrwxrwxrwx 1 root root 48 Nov 17 00:41 hgrepos.domainname.tld -> ../sites-available/hgrepos.domainname.tld
我同时使用, /etc/init.d/apache2重装
和 /etc/init.d/apache2重启
。阿帕奇没有告诉我,我试图加载格式不正确的配置。
I used both, /etc/init.d/apache2 reload
and /etc/init.d/apache2 restart
. Apache didn't tell me that I tried to load a malformed configuration.
该网站的根域正在 /无功/网络/论坛
和访问。
The sites for the root domain are under /var/www/forum
and accessible.
我对 /无功/网络/ 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的
文件只包含一些世界,你好!看到HTML如果子是可访问的。
The index.html
file just contains some Hello World! html to see if the subdomain is accessible.
所以现在回到我的第一个问题:为什么我无法通过浏览器访问的 hgrepos 子域
So now back to my first question: why can't I access to the hgrepos subdomain via my browser?
现在第二个,我想服务于某种水银(汞)库为我的私人项目,使用 hgweb
。我跟着这些指示:结果
结果
Now second, I want to serve some mercurial (hg) repositories for my private projects, using hgweb
. I followed those instructions:
http://mercurial.selenic.com/wiki/modwsgi
http://mercurial.selenic.com/wiki/HgWebDirStepByStepFtpOnly
下面是我下的配置文件中的 /无功/网络/ hgrepos / cgi-bin目录/
Here are my config files under /var/www/hgrepos/cgi-bin/:
hgweb.wsgi
#!/usr/bin/env python
#
# An example hgweb CGI script, edit as necessary
# See also http://mercurial.selenic.com/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工作吗?什么是真正错了我的配置?
好了,哇,这是多大的文字,但我不太清楚需要哪些信息,哪些不是。希望你能帮助我,任何暗示是有帮助的:)
Well, wow, this is much of text, but I'm not quite sure which information are needed and which aren't. Hope you can help me, any hint is helpful :)
推荐答案
好了,好消息 - 我固定我的问题。
Well, good news - I fixed my issues.
第一步是拆卸的libapache-MOD-WSGI-PY3和安装中的libapache-MOD-WSGI(在我尝试我重新安装了WSGI-PY3包了好几次,似乎是固定的,不知怎的,我的最后重新安装... )
First step was removing libapache-mod-wsgi-py3 and installing libapache-mod-wsgi (during my tries I re-installed wsgi-py3-package several times, seems like my last re-installation fixed that somehow...)
apt-get remove libapache2-mod-wsgi-py3
apt-get install libapach2-mod-wsgi-py3
apt-get autoremove
在此之后,重新启动Apache的让我在我的error.log中以下内容:
After that, restarting apache got me the following in my 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
,我建立了我的hgweb.wsgi文件是这样的:
Following this, I set up my hgweb.wsgi-file like this:
#!/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)
重启动Apache
Restarting Apache
/etc/init.d/apache2 restart
,现在一切对我的作品。
and now everything works for me.
再次非常感谢krtek谁真的帮助了我结束痛苦!让我很快乐:D
A big THANKS again to krtek who really helped out ending my pain! Made my day :D
这篇关于创建与Debian的apache的子域;创建hgweb子作为第二步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!