우분투 14의 nagios용 아파치 가상 호스트

우분투 14의 nagios용 아파치 가상 호스트

방금 Apache를 사용하여 Ubuntu 14 LTS에 nagios를 설치했습니다. example.com/nagios3을 통해 사이트에 액세스하고 있지만 nagios.example.com과 같은 nagios에 액세스하기 위해 가상 호스트를 사용하고 싶습니다. 이를 수행하는 가장 좋은 방법은 무엇입니까?

답변1

가정

  1. 표준 Apache2 서버는 Ubuntu 저장소에서 설치되며 기본 설치는 변경되지 않았습니다.
  2. Nagios는 기본적으로 /var/www/ 폴더에 설치되며 폴더 이름은 nagios3입니다.
  3. Nagios.example.com은 유효한 IP 주소로 확인되며 nagios 서버와 동일합니다.

nagios를 nagios.example.com으로 사용하는 단계 – SSH를 통해 서버에 접속하고 다음 명령을 실행합니다.
1. cd /etc/apache2/sites-available
2. sudo cp default nagios.example.com
3. sudo nano nagios.example.com
4 . 다음과 같아야 합니다. 이 코드를 복사하여 붙여넣지 마세요. 4, 5, 6, 11번째 줄에서 제가 언급한 항목을 추가하세요.

 NameVirtualHost *    
 <VirtualHost *>  
     ServerAdmin webmaster@localhost  
     ServerName nagios.example.com # Add this line
     ServerAlias    nagios # Add this line
     DocumentRoot /var/www/nagios3 # Add nagios3 at the end of this line
    <Directory /> 
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/nagios3/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
            RedirectMatch ^/$ /apache2-default/
    </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 /var/log/apache2/error.log

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

    CustomLog /var/log/apache2/access.log combined
    ServerSignature On

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>

  1. ^ O (파일 저장용)
  2. ^ X (나노 편집기 종료용)
  3. sudo a2ensite nagios.example.com (가상 호스트 활성화를 위한 것입니다)
  4. sudo 서비스 apache2 다시 시작
  5. 브라우저를 열고 입력하세요.http://nagios.example.comnagios 로그인 페이지를 볼 수 있어야 합니다(nagios에 액세스하는 데 사용하는 시스템에서 nagios.example.com을 확인할 수 있는지 확인하세요. 로컬 호스트 파일에 항목을 만들 수 없는 경우).

이것이 도움이 되기를 바랍니다
. 감사합니다

관련 정보