2014-09-16 2 views
0

나는 많은 사이트가 실행되는 dev 서버를 가지고 있으며 매주마다 변경된다. 링크를 제공하기 위해 내 기본 웹 페이지를 지속적으로 업데이트하는 대신 동적 목록을 원합니다.내 dev 사이트의 기본 웹 페이지에 표시하기 위해 apache vhosts 파일의 현재 항목을 모두 나열하려면 어떻게합니까?

는 기본적으로, 우리의 개발자를위한 동적

<ul> 
    <li><a href="http://example1.dev.ourdomain.com">example1.dev.ourdomain.com</a></li> 
    <li><a href="http://example1.staging.ourdomain.com">example1.dev.ourdomain.com</a></li> 
    <li><a href="http://example2.dev.ourdomain.com">example2.dev.ourdomain.com</a></li> 
    <li><a href="http://example2.staging.ourdomain.com">example2.dev.ourdomain.com</a></li> 
</ul> 

을 표시합니다.

답변

1

매우 간단한 사이트이므로 웹 사이트에 대한 링크 만 있으므로 서버 쪽 포함과 함께 html을 사용하려고합니다. 그들로부터 링크 URL을 빼고 만들

AddType text/html .shtml 
AddOutputFilter INCLUDES .shtml 

의 crontab을 : I (예) /etc/httpd/conf/httpd.conf 파일로 아파치 설정이 필요합니다

1)

30 2 * * * /usr/sbin/httpd -S | egrep -i 'ourdomain.com' | egrep -i 'namevhost' | sed -e 's/.* \([0-9A-Za-z.-]*\.ourdomain\.com\).*/<li><a href="http:\/\/\1">\1<\/a><\/li>/i' > /websites/ourdomain/current_sites.html 

/websites/ourdomain/index.shtml

에서 HTML 페이지를 작성)

3 (한 가지 문제는 ...이 좀 더 구체적으로해야 할 수도 있습니다 모든 단지 namevhost 항목입니다)

<html><body> 
    <h3>This list is compiled from the current VHOST entries every night at 2:30 am</h3> 
    <ul class="links"> 
    <!--#include virtual="current_sites.html" --> 
    </ul> 
</body></html> 

4)

<VirtualHost *:80> 

    ServerName dev.ourdomain.com 
    ServerAlias *.dev.ourdomain.com 

    DocumentRoot /websites/ourdomain 
    <Directory /websites/ourdomain> 
    # This relaxes Apache security settings. 
    AllowOverride all 
    # MultiViews must be turned off. 
    Options -MultiViews 
    Options +Includes 
    # Redirects 
    RewriteEngine on 
    RewriteBase /websites/ourdomain 
    </Directory> 

    # Our security group 
    <Location /> 
    Require user admin 
    </Location> 

</VirtualHost> 

)이 필요한 모든, 우리의 설치되지 않습니다 (사람 유형 아무것도는 우리가 이미 dev.ourdomain.com에서 처리하지 않은 때마다이에 기본값으로 가상 호스트 파일을 업데이트 나는 그것이라고 생각한다.

관련 문제