在 apache2 上运行 redmine 和 Passenger

在 apache2 上运行 redmine 和 Passenger

我正在尝试在我的 Ubuntu 12.04 / Apache/2.2.22 服务器上运行 redmine。我正在关注本文档它在我的笔记本电脑上运行良好,但无法在我的 aws 网络服务器上运行。我猜问题出在 apache 上,因为我在尝试访问页面 www.mydomain.com/redmine 时收到 404 错误

我一步一步按照文档操作,但不起作用。我不太熟悉 VHost 配置,所以有人能告诉我我的配置是否有问题吗:

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName www.yourownpoet.com
    DocumentRoot /var/www/yourownpoet/web
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/yourownpoet/web>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        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.prod.log

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

    CustomLog ${APACHE_LOG_DIR}/access.prod.log combined
<IfModule mod_userdir.c>
    UserDir html/yourownpoet/web
</IfModule>

<Directory /home/ubuntu/html/yourownpoet/web>
    AllowOverride FileInfo AuthConfig Limit
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS>
      Order allow,deny
      Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
    Order deny,allow
    Deny from all
  </LimitExcept>
</Directory>

<Directory /var/www/redmine>
    RailsBaseURI /redmine
    PassengerResolveSymlinksInDocumentRoot on
</Directory>
</VirtualHost>

PS:我在我的 DocumentRoot 文件夹中创建了到 redmine 公共目录的符号链接:

sudo ln -s /usr/share/redmine/public /var/www/yourownpoet/web

那是对的吗?

答案1

问题解决了!

问题是我在 DocumentRoot 文件夹中的 .htaccess 中设置了重写规则。此规则对于运行我的 Symfony2 网站是必需的,但却与 redmine 混淆了。

我必须在虚拟主机配置中专门关闭 redmine 的 RewriteEngine:

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName www.yourownpoet.com
    DocumentRoot /var/www/yourownpoet/web
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/yourownpoet/web>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
        <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*)$ /app.php [QSA,L]
        </IfModule>
    </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>

    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.prod.log

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

    CustomLog ${APACHE_LOG_DIR}/access.prod.log combined
<IfModule mod_userdir.c>
    UserDir html/yourownpoet/web
</IfModule>

<Directory /home/ubuntu/html/yourownpoet/web>
    AllowOverride FileInfo AuthConfig Limit
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS>
      Order allow,deny
      Allow from all
    </LimitExcept>
</Directory>

<Directory /var/www/yourownpoet/web/redmine>
    <IfModule mod_rewrite.c>
        RewriteEngine off
    </IfModule>
    RailsBaseURI /redmine
    PassengerResolveSymlinksInDocumentRoot on
</Directory>
</VirtualHost>

希望这可以帮助。

相关内容