Apache 将站点从本地移动到Ubuntu服务器

Apache 将站点从本地移动到Ubuntu服务器,apache,.htaccess,ubuntu,pyrocms,Apache,.htaccess,Ubuntu,Pyrocms,我已经在本地使用PyroCMS构建了一个站点——工作非常完美,但将其移动到新的Ubuntu服务器后,我发现了一些问题 到目前为止,这是我的过程: 我将文件和数据库移动到我们的Ubuntu服务器上,并指向数据库进行设置 我指向主页,它工作正常(除了显示图像),数据库连接正确 然后我指向管理员URL“sub.domain.com/admin”它说“找不到-请求的URL/events\u培训在此服务器上找不到” 当指向子页面“sub.domain.com/events\u training”时,我也会

我已经在本地使用PyroCMS构建了一个站点——工作非常完美,但将其移动到新的Ubuntu服务器后,我发现了一些问题

到目前为止,这是我的过程:

  • 我将文件和数据库移动到我们的Ubuntu服务器上,并指向数据库进行设置
  • 我指向主页,它工作正常(除了显示图像),数据库连接正确
  • 然后我指向管理员URL“sub.domain.com/admin”它说“找不到-请求的URL/events\u培训在此服务器上找不到”
  • 当指向子页面“sub.domain.com/events\u training”时,我也会遇到同样的错误
  • 我确保mod rewrite已启用,但仍然出现相同的错误
  • 我尝试了“sub.domain.com/index.php/admin”,得到了相同的错误
  • 然后,我在/etc/apache2/sites available/default中将AllowOverride设置为“All”,以使.htaccess文件工作并重新加载apache-这将导致主页显示一个空白页面,sub.domain.com/admin现在也为空
  • 我不知道下一步该检查什么

    以下是我的.htaccess文件中的内容

    # Multiple Environment config
    # Set this to development, staging or production
    SetEnv PYRO_ENV staging
    
    <IfModule mod_rewrite.c>
    
    # Make sure directory listing is disabled
    Options +FollowSymLinks -Indexes
    # disable the Apache MultiViews directive if it is enabled on the server. It plays havoc with URL rewriting
    Options -MultiViews
    RewriteEngine on
    
    # Automatically determine and set the PYRO_ENV variable
        #RewriteCond %{HTTP_HOST} ^local.domain.com$
        #RewriteRule (.*) $1 [E=PYRO_ENV:development]
    
        #RewriteCond %{HTTP_HOST} ^stage.domain.com$
        #RewriteRule (.*) $1 [E=PYRO_ENV:staging]
    
        #RewriteCond %{HTTP_HOST} ^domain.com$
        #RewriteRule (.*) $1 [E=PYRO_ENV:production]
    
    # NOTICE: If you get a 404 play with combinations of the following commented out lines
    #AllowOverride All
    #RewriteBase /wherever/pyro/is
    
    # Restrict your site to only one domain
    # !important USE ONLY ONE OPTION
    
    # Option 1: To rewrite "www.domain.com -> domain.com" uncomment the following lines.
    #RewriteCond %{HTTPS} !=on
    #RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    #RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    
    # Option 2: To rewrite "domain.com -> www.domain.com" uncomment the following lines.
    #RewriteCond %{HTTPS} !=on
    #RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
    #RewriteCond %{HTTP_HOST} (.+)$ [NC]
    #RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
    
    # Keep people out of codeigniter directory and Git/Mercurial data
    RedirectMatch 403 ^/.*/(system/cms/cache|system/codeigniter|system/cms/config|system/cms/logs|\.git|\.hg).*$
    
    # Send request via index.php (again, not if its a real file or folder)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    <IfModule mod_php5.c>
        RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>
    
    <IfModule !mod_php5.c>
        RewriteRule ^(.*)$ index.php?/$1 [L]
    </IfModule>
    
    </IfModule>
    
    #多环境配置
    #将此设置为“开发”、“暂存”或“生产”
    SetEnv PYRO_环境分期
    #确保目录列表已禁用
    选项+FollowSymLinks-索引
    #如果在服务器上启用了Apache MultiView指令,请禁用该指令。它会破坏URL重写
    选项-多视图
    重新启动发动机
    #自动确定并设置PYRO_ENV变量
    #重写cond%{HTTP_HOST}^local.domain.com$
    #重写规则(.*)$1[E=PYRO_环境:开发]
    #重写cond%{HTTP_HOST}^stage.domain.com$
    #重写规则(.*)$1[E=PYRO_ENV:staging]
    #重写cond%{HTTP_HOST}^domain.com$
    #重写规则(.*)$1[E=PYRO_环境:生产]
    #注意:如果你得到一个404播放与以下注释线的组合
    #允许超越所有
    #重写base/where/pyro/is
    #将您的站点仅限于一个域
    # !重要信息:仅使用一个选项
    #选项1:要重写“www.domain.com->domain.com”,请取消对以下行的注释。
    #重写cond%{HTTPS}=在…上
    #重写cond%{HTTP_HOST}^www\.(.+)$[NC]
    #重写规则^(.*)$http://%1/$1[R=301,L]
    #选项2:要重写“domain.com->www.domain.com”,请取消对以下行的注释。
    #重写cond%{HTTPS}=在…上
    #重写cond%{HTTP_HOST}^www\..+$[NC]
    #重写cond%{HTTP_HOST}(+)$[NC]
    #重写规则^(.*)$http://www.%1/$1[R=301,L]
    #让人们远离codeigniter目录和Git/Mercurial数据
    重定向匹配403^/*/(system/cms/cache | system/codeigniter | system/cms/config | system/cms/logs | \.git | \.hg)*$
    #通过index.php发送请求(同样,如果是真实的文件或文件夹,则不发送请求)
    重写cond%{REQUEST_FILENAME}-F
    重写cond%{REQUEST_FILENAME}-D
    重写规则^(.*)$index.php/$1[L]
    重写规则^(.*)$index.php?/$1[L]
    
    问题解决了


    .htaccess文件中的环境设置错误-它应该是“生产”的,与数据库配置设置相匹配。

    Apache日志文件中是否有错误?