subdomain - 如何将 robots.txt 与 gitlab 和 apache + 子域一起使用?

标签 subdomain virtualhost robots.txt gitlab

我无法访问我的 robots.txt(位于/home/git/gitlab/public/robots.txt)
我关注了this recipe用于在 centos + apache 上安装

我已经尝试排除 robots.txt 但这还不够 这是我当前的 gitlab VirtualHost

<VirtualHost git.domain.tld:80>                                              
   ServerName git.domain.tld
   ServerSignature Off                                                    
   ProxyPreserveHost On                                                         

  <Location />                                                                  
    Order deny,allow                                                            
    Allow from all                                                              

    ProxyPassReverse http://127.0.0.1:8080                                      
    ProxyPassReverse http://git.domain.tld/
  </Location>                                                                   

  #apache equivalent of nginx try files                                         
  # http://serverfault.com/questions/290784/what-is-apaches-equivalent-of-nginxs-try-files                                                                      
  # http://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab        

RewriteEngine on                                                              

  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f                          

  RewriteRule .* http://127.0.0.1:8080%{REQUEST_URI} [P,QSA]                    
  # needed for downloading attachments                                          
  DocumentRoot /home/git/gitlab/public                                          


  #Set up apache error documents, if back end goes down (i.e. 503 error) then a maintenance/deploy page is thrown up.                                           
  ErrorDocument 404 /404.html                                                   
  ErrorDocument 422 /422.html                                                   
  ErrorDocument 500 /500.html                                                   
  ErrorDocument 503 /deploy.html                                                

  LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common_forwarded       
  ErrorLog  /var/log/httpd/logs/gitlab_error.log           
  CustomLog /var/log/httpd/logs/gitlab_forwarded.log common_forwarded           
  CustomLog /var/log/httpd/logs/gitlab_access.log combined env=!dontlog         
  CustomLog /var/log/httpd/logs/gitlab.log combined                             
</VirtualHost>            

最佳答案

努力改变 /home/git/gitlab/config/environments/production.rb config.serve_static_assets = true (默认为false)

关于subdomain - 如何将 robots.txt 与 gitlab 和 apache + 子域一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23364975/

相关文章:

Angular 子域

php - 覆盖每个虚拟主机的 php_value

php - VirtualHost 模块在交付给客户之前搜索和替换 HTML 网站代码

node.js - "Lighthouse was unable to download a robots.txt file"尽管文件可访问

.htaccess 子域重定向不起作用

Azure 子域链接到应用服务

redirect - Nginx 子域 : Redirect/. Let's Encrypt 的已知路径

apache2 - 如何将子域映射到在端口 8086 上运行的 tomcat 8 Web 应用程序

seo - 如何让谷歌抓取 pdf 文件但不索引它们?

html - robot.txt 允许而不是禁止