Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6835577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:14:57+00:00 2026-05-26T23:14:57+00:00

After hours of trying to setup subdomains on my dedicated root server, I’m asking

  • 0

After hours of trying to setup subdomains on my dedicated root server, I’m asking you for help.

Target:

  • being able to create and access subdomains
  • setup an own subdomain for mercurial repositories, using hgweb

Information about the server:

  • Debian Linux, Kernel 2.6.32-028stab094.3
  • Apache/2.2.16 (Debian)
  • Mercurial 1.6.4
  • libapache2-mod-wsgi-py3 installed

First question: what is wrong with my apache configuration that I can’t access my subdomains via the browser?

Actually, I can access the root domain and the sites which are installed there.

My configuration:
/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/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>

My /etc/apache2/httpd.conf file is empty.

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

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.

My folder structure for /var/www/hgrepos looks like:

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

The index.html file just contains some Hello World! html to see if the subdomain is accessible.

So now back to my first question: why can’t I access to the hgrepos subdomain via my browser?

Now second, I want to serve some mercurial (hg) repositories for my private projects, using hgweb. I followed those instructions:
https://www.mercurial-scm.org/wiki/modwsgi
https://www.mercurial-scm.org/wiki/HgWebDirStepByStepFtpOnly

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 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/*

Rights of the files:

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

So now my second question: how can I get hgweb working? What’s actually wrong with my configuration?

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 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:14:58+00:00Added an answer on May 26, 2026 at 11:14 pm

    Well, good news – I fixed my issues.

    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
    

    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
    

    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)
    

    Restarting Apache

    /etc/init.d/apache2 restart
    

    and now everything works for me.

    A big THANKS again to krtek who really helped out ending my pain! Made my day 😀

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am asking for help, after hours of trying to figure this out myself.
After some hours of trying, I want to ask how to loop a video
OK I give up - after 5 solid hours trying to get a django
im trying to customize this page indicator with half succes, but after many hours
I am so frustrated right now after several hours trying to find where shared_ptr
After hours of trying to wrap my head around pattern matching, I'm throwing the
After countless hours trying to style a QComboBox, I'm stuck with the top and
I am trying to install PIL on Mac OSX 10.7.4 but after several hours
After spending about 6-8 hours trying to digest the Manacher's algorithm, I am ready
I'm getting confused and frustrated after a few hours of trying all kinds of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.