试图设置Apache + svn,但遇到了麻烦。 http:// localhost不起作用

时间:2022-10-06 10:18:34

I'm running Ubuntu 8.10 and I've installed the necessary packages as fast as I can tell. Under System > Administration > Services I see "Webserver (Apache2)" on the list.

我正在运行Ubuntu 8.10,我已尽快安装必要的软件包。在系统>管理>服务下,我在列表中看到“Webserver(Apache2)”。

Googling around suggested that there might be a problem with the /etc/hosts file not having a line reading "127.0.0.1 localhost", but I checked the file and it's there. I'm at a loss as to what to do next.

谷歌搜索周围表示/ etc / hosts文件可能有一个问题,没有行读取“127.0.0.1 localhost”,但我检查了文件,它就在那里。我不知道下一步该做什么。

To be more clear, attempting to go to http://localhost/ doesn't load any page. The browser just keeps loading, but the page never comes up.

更清楚的是,尝试转到http:// localhost /不会加载任何页面。浏览器只是继续加载,但页面永远不会出现。

Here is my access.log:

这是我的access.log:

192.168.1.101 - - [09/Feb/2009:09:59:54 -0800] "HEAD / HTTP/1.0" 200 - "-" "-"
192.168.1.101 - - [10/Feb/2009:02:10:26 -0800] "HEAD / HTTP/1.0" 200 - "-" "-"

and error.log (mostly just me resetting in an attempt to get it to work by fiddling with it)

和error.log(主要是我通过摆弄来重置以试图让它工作)

[Mon Feb 09 08:17:47 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Mon Feb 09 15:40:27 2009] [notice] caught SIGTERM, shutting down
[Mon Feb 09 15:42:13 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Mon Feb 09 15:58:27 2009] [notice] caught SIGTERM, shutting down
[Mon Feb 09 15:59:57 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Mon Feb 09 16:31:12 2009] [notice] caught SIGTERM, shutting down
[Mon Feb 09 16:32:45 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Mon Feb 09 16:46:26 2009] [notice] caught SIGTERM, shutting down
[Mon Feb 09 16:49:53 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Mon Feb 09 22:54:51 2009] [notice] caught SIGTERM, shutting down
[Mon Feb 09 22:58:19 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Tue Feb 10 00:02:04 2009] [notice] caught SIGTERM, shutting down
[Tue Feb 10 00:04:54 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Tue Feb 10 00:18:24 2009] [notice] caught SIGTERM, shutting down
[Tue Feb 10 00:18:25 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Tue Feb 10 00:28:58 2009] [notice] caught SIGTERM, shutting down
[Tue Feb 10 00:28:59 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Tue Feb 10 00:32:10 2009] [notice] caught SIGTERM, shutting down
[Tue Feb 10 00:32:11 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Tue Feb 10 00:43:45 2009] [notice] caught SIGTERM, shutting down
[Tue Feb 10 00:43:46 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Tue Feb 10 00:45:51 2009] [notice] caught SIGTERM, shutting down
[Tue Feb 10 00:45:52 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Tue Feb 10 02:21:34 2009] [notice] SIGUSR1 received.  Doing graceful restart
[Tue Feb 10 02:21:34 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Tue Feb 10 02:24:39 2009] [notice] SIGUSR1 received.  Doing graceful restart
[Tue Feb 10 02:24:40 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Tue Feb 10 04:00:33 2009] [notice] SIGUSR1 received.  Doing graceful restart
[Tue Feb 10 04:00:33 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Tue Feb 10 04:29:03 2009] [notice] SIGUSR1 received.  Doing graceful restart
[Tue Feb 10 04:29:03 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Tue Feb 10 04:31:12 2009] [notice] SIGUSR1 received.  Doing graceful restart
[Tue Feb 10 04:31:12 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Tue Feb 10 04:39:45 2009] [notice] caught SIGTERM, shutting down
[Tue Feb 10 04:41:23 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Tue Feb 10 04:48:42 2009] [notice] caught SIGTERM, shutting down
[Tue Feb 10 04:48:43 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations
[Tue Feb 10 04:48:45 2009] [notice] caught SIGTERM, shutting down
[Tue Feb 10 04:48:50 2009] [notice] Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations

2 个解决方案

#1


In order to have SVN working with apache under Ubuntu you need to:

为了让SVN在Ubuntu下使用apache,你需要:

  • install the proper packages
  • 安装合适的包

  • enable the proper apache modules
  • 启用适当的apache模块

  • provide a working configuration file for apache
  • 为apache提供工作配置文件

  • creating a repository
  • 创建存储库

I've installed SVN through apache under various versions of Ubuntu and Debian, but never with the newest Ubuntu. I hope that my configuration will help you.

我已经在各种版本的Ubuntu和Debian下通过apache安装了SVN,但从未使用过最新的Ubuntu。我希望我的配置能帮到你。

Install the proper packages

安装合适的包

Make sure that you have the following packages installed 'libapache2-svn' and 'subversion'.

确保安装了以下软件包'libapache2-svn'和'subversion'。

Enable the proper apache modules

启用正确的apache模块

Go to the folder '/etc/apache2/mods-enabled' and verify that the files 'dav_svn.conf' and 'dav_svn.load' are there. If they are missing simply do:

转到文件夹'/ etc / apache2 / mods-enabled'并验证文件'dav_svn.conf'和'dav_svn.load'是否存在。如果他们失踪了,只需:

sudo a2enmod dav_svn

Provide a working configuration file for apache

为apache提供工作配置文件

This is where the fun starts. I've decided to use a virtual host for my own repository even if it's not visible to the outside world. Let's assume that you decide to make your repository available under http://svn.localhost/repos/. First add the following entry to '/etc/hosts'

这是有趣的开始。我决定将虚拟主机用于我自己的存储库,即使外部世界看不到它。假设您决定在http://svn.localhost/repos/下提供存储库。首先将以下条目添加到'/ etc / hosts'

127.0.0.1 svn.localhost

Then create a configuration file for apache and save it to '/etc/apache2/sites-enabled/' :

然后为apache创建配置文件并将其保存到'/ etc / apache2 / sites-enabled /':

<VirtualHost *>
    ServerName svn.localhost

    ErrorLog /var/log/apache2/svn-error.log
    CustomLog /var/log/apache2/svn-access.log combined


    <Location /repos>

        # Enable the repository
        DAV svn

        # Path to your repository
        SVNPath /home/subversion

        # The following allows for basic http authentication.
        AuthType Basic
        AuthName "Subversion Repository"
        AuthUserFile /etc/apache2/dav_svn.passwd

        # Allow anonymous read, but make committers authenticate themselves
        <LimitExcept GET PROPFIND OPTIONS REPORT>
            Require valid-user
        </LimitExcept> 

        # Have the network shares autocomit their modifications
        SVNAutoversioning on

        # Needed because Microsoft Web Folders defaults to a timeout of 120, a higher number will work better
        DAVMinTimeout 600

        #
        # Broken WebDAV for Windows XP
        #
        BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
        BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
        BrowserMatch "Microsoft-WebDAV-MiniRedir/5.1.2600" redirect-carefully
        BrowserMatch "^WebDrive" redirect-carefully
        BrowserMatch "^WebDAVFS" redirect-carefully

        <IfModule mod_headers.c>
            Header add MS-Author-Via "DAV"
        </IfModule>

        <IfModule mod_encoding.c>
            EncodingEngine on
            NormalizeUsername on
        </IfModule>
    </Location>

</VirtualHost>

Creating a repository

创建存储库

Create your repository with:

创建您的存储库:

sudo mkdir -p /home/subversion/ sudo svnadmin create /home/subversion/ sudo chown -R www-data:www-data /home/subversion/

sudo mkdir -p / home / subversion / sudo svnadmin create / home / subversion / sudo chown -R www-data:www-data / home / subversion /

If you decide to locate your repository under a different folder make sure to update the apache setting of /home/subversion/ in the configuration file.

如果您决定将存储库放在不同的文件夹下,请确保在配置文件中更新/ home / subversion /的apache设置。

Update the your password file /etc/apache2/dav_svn.passwd with command htpasswd.

使用命令htpasswd更新密码文件/etc/apache2/dav_svn.passwd。

#2


If I remember correctly, you can configure which networks interfaces Apache binds to, which may not include localhost by default.

如果我没记错的话,你可以配置Apache绑定的接口,默认情况下可能不包括localhost。

Have you tried connecting on your machine's external hostname, or IP (e.g. 192.168.x.y)?

您是否尝试连接计算机的外部主机名或IP(例如192.168.x.y)?

Also, trying reading the "Installing Apache" part of this guide for Ubuntu 8.10.

另外,尝试阅读Ubuntu 8.10本指南的“安装Apache”部分。

#1


In order to have SVN working with apache under Ubuntu you need to:

为了让SVN在Ubuntu下使用apache,你需要:

  • install the proper packages
  • 安装合适的包

  • enable the proper apache modules
  • 启用适当的apache模块

  • provide a working configuration file for apache
  • 为apache提供工作配置文件

  • creating a repository
  • 创建存储库

I've installed SVN through apache under various versions of Ubuntu and Debian, but never with the newest Ubuntu. I hope that my configuration will help you.

我已经在各种版本的Ubuntu和Debian下通过apache安装了SVN,但从未使用过最新的Ubuntu。我希望我的配置能帮到你。

Install the proper packages

安装合适的包

Make sure that you have the following packages installed 'libapache2-svn' and 'subversion'.

确保安装了以下软件包'libapache2-svn'和'subversion'。

Enable the proper apache modules

启用正确的apache模块

Go to the folder '/etc/apache2/mods-enabled' and verify that the files 'dav_svn.conf' and 'dav_svn.load' are there. If they are missing simply do:

转到文件夹'/ etc / apache2 / mods-enabled'并验证文件'dav_svn.conf'和'dav_svn.load'是否存在。如果他们失踪了,只需:

sudo a2enmod dav_svn

Provide a working configuration file for apache

为apache提供工作配置文件

This is where the fun starts. I've decided to use a virtual host for my own repository even if it's not visible to the outside world. Let's assume that you decide to make your repository available under http://svn.localhost/repos/. First add the following entry to '/etc/hosts'

这是有趣的开始。我决定将虚拟主机用于我自己的存储库,即使外部世界看不到它。假设您决定在http://svn.localhost/repos/下提供存储库。首先将以下条目添加到'/ etc / hosts'

127.0.0.1 svn.localhost

Then create a configuration file for apache and save it to '/etc/apache2/sites-enabled/' :

然后为apache创建配置文件并将其保存到'/ etc / apache2 / sites-enabled /':

<VirtualHost *>
    ServerName svn.localhost

    ErrorLog /var/log/apache2/svn-error.log
    CustomLog /var/log/apache2/svn-access.log combined


    <Location /repos>

        # Enable the repository
        DAV svn

        # Path to your repository
        SVNPath /home/subversion

        # The following allows for basic http authentication.
        AuthType Basic
        AuthName "Subversion Repository"
        AuthUserFile /etc/apache2/dav_svn.passwd

        # Allow anonymous read, but make committers authenticate themselves
        <LimitExcept GET PROPFIND OPTIONS REPORT>
            Require valid-user
        </LimitExcept> 

        # Have the network shares autocomit their modifications
        SVNAutoversioning on

        # Needed because Microsoft Web Folders defaults to a timeout of 120, a higher number will work better
        DAVMinTimeout 600

        #
        # Broken WebDAV for Windows XP
        #
        BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
        BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
        BrowserMatch "Microsoft-WebDAV-MiniRedir/5.1.2600" redirect-carefully
        BrowserMatch "^WebDrive" redirect-carefully
        BrowserMatch "^WebDAVFS" redirect-carefully

        <IfModule mod_headers.c>
            Header add MS-Author-Via "DAV"
        </IfModule>

        <IfModule mod_encoding.c>
            EncodingEngine on
            NormalizeUsername on
        </IfModule>
    </Location>

</VirtualHost>

Creating a repository

创建存储库

Create your repository with:

创建您的存储库:

sudo mkdir -p /home/subversion/ sudo svnadmin create /home/subversion/ sudo chown -R www-data:www-data /home/subversion/

sudo mkdir -p / home / subversion / sudo svnadmin create / home / subversion / sudo chown -R www-data:www-data / home / subversion /

If you decide to locate your repository under a different folder make sure to update the apache setting of /home/subversion/ in the configuration file.

如果您决定将存储库放在不同的文件夹下,请确保在配置文件中更新/ home / subversion /的apache设置。

Update the your password file /etc/apache2/dav_svn.passwd with command htpasswd.

使用命令htpasswd更新密码文件/etc/apache2/dav_svn.passwd。

#2


If I remember correctly, you can configure which networks interfaces Apache binds to, which may not include localhost by default.

如果我没记错的话,你可以配置Apache绑定的接口,默认情况下可能不包括localhost。

Have you tried connecting on your machine's external hostname, or IP (e.g. 192.168.x.y)?

您是否尝试连接计算机的外部主机名或IP(例如192.168.x.y)?

Also, trying reading the "Installing Apache" part of this guide for Ubuntu 8.10.

另外,尝试阅读Ubuntu 8.10本指南的“安装Apache”部分。