Ubuntu Apache2配置404错误

Ubuntu Apache2配置404错误,ubuntu,apache2,httpd.conf,Ubuntu,Apache2,Httpd.conf,我们的系统管理员刚刚离开了我正在做的一个项目,我一直在努力配置我们的生产服务器以匹配测试(一切正常)。在服务器配置方面我不是很在行,而且我也遇到过很多死胡同,所以我非常感谢能提供的任何帮助 通过将TEST/var/www复制到PROD,我将代码从TEST升级到PROD。因此,PROD中的应用程序现在驻留在PROD/var/www/www中。 现在,我可以访问生产上的应用程序登录页(my.Production.com/www),但无法访问var/www/www/子目录中的任何文件。我一直收到一个4

我们的系统管理员刚刚离开了我正在做的一个项目,我一直在努力配置我们的生产服务器以匹配测试(一切正常)。在服务器配置方面我不是很在行,而且我也遇到过很多死胡同,所以我非常感谢能提供的任何帮助

通过将TEST/var/www复制到PROD,我将代码从TEST升级到PROD。因此,PROD中的应用程序现在驻留在PROD/var/www/www中。 现在,我可以访问生产上的应用程序登录页(my.Production.com/www),但无法访问var/www/www/子目录中的任何文件。我一直收到一个404找不到的错误

我已经将站点的配置(名为“realto”的文件)从TEST复制到PROD,并运行了一个ensite来创建指向sites enabled文件夹的符号链接,但在生产中仍然出现404错误

有谁能就可能出现的问题向我提供建议,或为我指出正确的方向

编辑:我在下面包含了httpd.conf、ports.conf和站点配置文件的文本

httpd.conf:

ServerName    my.server.com
ServerSignature Off
ServerTokens Prod
<Directory />
  Order Deny,Allow
  Deny from all
  Options None
  AllowOverride None
</Directory>
<DirectoryMatch /var/www/*>
  Order Allow,Deny
  Allow from all
  AllowOverride All
  Options None
</DirectoryMatch>
<DirectoryMatch phpmyadmin>
  Order Allow,Deny
  Allow from all
  Options None
</DirectoryMatch>
ServerName my.server.com
服务器签名关闭
服务器令牌产品
命令拒绝,允许
全盘否定
选项无
不允许超限
命令允许,拒绝
通融
允许超越所有
选项无
命令允许,拒绝
通融
选项无
站点配置文件:

    <VirtualHost *:80>
    ServerAdmin xxx@xxxxxxxx.xxx

    DocumentRoot /var/www/www
    <Directory />
        #Options FollowSymLinks
        #AllowOverride None
                Order Deny,Allow
                Deny from All
    </Directory>
    <Directory /var/www/>
                #RewriteEngine On
                #RewriteBase /
                #RewriteCond %{REQUEST_FILENAME} -s [OR]
                #RewriteCond %{REQUEST_FILENAME} -l [OR]
                #RewriteCond %{REQUEST_FILENAME} -d
                #RewriteRule ^.*$ - [NC,L]
                #RewriteRule ^.*$ index.php [NC,L]
                Order Allow,Deny
                Allow from all

        Options -Indexes FollowSymLinks MultiViews
        AllowOverride All
    </Directory>
    <Directory /var/www/www/application/configs/>
          <Files ~ "\.ini$">
                Deny from All
          </Files>
    </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>

服务器管理员xxx@xxxxxxxx.xxx
DocumentRoot/var/www/www
#选项如下符号链接
#不允许超限
命令拒绝,允许
全盘否定
#重新启动发动机
#重写基/
#RewriteCond%{REQUEST_FILENAME}-s[或]
#RewriteCond%{REQUEST_FILENAME}-l[或]
#RewriteCond%{REQUEST_FILENAME}-d
#重写规则^.*$-[NC,L]
#重写规则^.*$index.php[NC,L]
命令允许,拒绝
通融
选项-索引跟随符号链接多视图
允许超越所有
全盘否定
ScriptAlias/cgi-bin//usr/lib/cgi-bin/
不允许超限
选项+执行CGI-多视图+符号链接所有者匹配
命令允许,拒绝
通融
ErrorLog${APACHE_LOG_DIR}/error.LOG
#可能的值包括:调试、信息、通知、警告、错误、临界值、,
#警惕,埃默格。
日志级别警告
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
别名/doc/“/usr/share/doc/”
选项索引多视图跟随符号链接
不允许超限
命令拒绝,允许
全盘否定
允许从127.0.0.0/255.0.0.0::1/128开始
ports.conf:

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz

NameVirtualHost *:80
Listen 80

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>
#如果您只是在此处更改端口或添加更多端口,您也可能
#必须更改中的VirtualHost语句
#/etc/apache2/sites enabled/000默认值
#如果您从2.2.9-3之前的版本升级(即从
#Debian蚀刻)。请参见/usr/share/doc/apache2.2-common/NEWS.Debian.gz和
#README.Debian.gz
名称虚拟主机*:80
听80
#如果在此处添加NameVirtualHost*:443,则还必须进行更改
#/etc/apache2/sites available/default ssl中的VirtualHost语句
#到
#SSL命名虚拟主机的服务器名称指示当前不可用
#由Windows XP上的MSIE支持。
听我说
听我说

首先要做的是使DocumentRoot和条目匹配

DocumentRoot /var/www/www
<Directory /var/www/www>
    #RewriteEngine On
    #RewriteBase /
    #RewriteCond %{REQUEST_FILENAME} -s [OR]
    #RewriteCond %{REQUEST_FILENAME} -l [OR]
    #RewriteCond %{REQUEST_FILENAME} -d
    #RewriteRule ^.*$ - [NC,L]
    #RewriteRule ^.*$ index.php [NC,L]
    Order Allow,Deny
    Allow from all

    Options -Indexes FollowSymLinks MultiViews
    AllowOverride All
</Directory>

这样,就可以立即清楚地知道您所处的环境,并且不会让人感到困惑。

测试和生产是在同一台机器上进行的吗?从您的问题来看,prod似乎位于test的子目录中?听起来不对。。另外,你能把你的vhosts贴在粘贴箱上吗?你可能不会有很多人愿意从第三方网站下载文件,而不知道它们包含什么…谢谢@bradym,我已经编辑了这个问题,将vhosts包括在内。TEST和PROD是云中独立的虚拟机;prod不在test的子目录中。谢谢@bradym。我已经做了建议的更改,包括取消对重写条件的评论并重新启动服务器,但现在我在尝试访问站点上的任何位置时出错(以前访问者被重定向到
/var/www/blog
文件夹中的博客站点,但他们无法再看到此内容)。你知道为什么吗?我在上面的问题中没有看到任何关于博客文件夹的内容,所以我不确定重定向是如何执行的。您的站点的index.php文件位于哪里?是在/var/www还是/var/www/www?index.php文件所在的位置就是DirectoryRoot应该指向的位置。当我建议进行上述更改时,我假设您希望该站点呈现在example.com/而不是example.com/www上。不确定是不是这样。
/var/www/example.com/test/htdocs
/var/www/example.com/www/htdocs