zabbix_直接使用80端口根目錄訪問

一般在ubuntu debian 系統是使用apt-get 包管理工具安裝完zabbix-server後,默認的Apache是創建一個zabbix虛擬目錄來提供訪問,類似這樣http://x.x.x.x/zabbix,現希望能夠直接通過http://x.x.x.x 就能訪問;

Ubuntu debian 系統的Apache 配置文件目錄結構和redhat系列是有點不同的;

wKiom1bWvsSgfM2_AAOtHTkcl-w815.jpg  

根據上圖的每個目錄的解釋,我在sites-available目錄下上刪除了默認的站點文件,並創建了新的zabbix文件,然後通過ln –s 連接到sites-enable 目錄下;

wKioL1bWy8vTNmvlAADhIThkDcM364.jpg  

現在重啓apache 即可直接訪問zabbix站點;

看看兩個文件內的具體內容;


#就是修改了站點的根目錄
root@8f52c23e51e9:/etc/apache2/sites-enabled# vim zabbix-server3.0.conf 
<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /usr/share/zabbix/

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
                #Include conf-available/serve-cgi-bin.conf                                                                             
</VirtualHost>
vim conf-enabled/zabbix.conf 
#註釋了Alisa 配置
# Define /zabbix alias, this is the default
#<IfModule mod_alias.c>
#    Alias /zabbix /usr/share/zabbix
#</IfModule>

<Directory "/usr/share/zabbix">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all

    <IfModule mod_php5.c>
        php_value max_execution_time 300
        php_value memory_limit 128M
        php_value post_max_size 16M
        php_value upload_max_filesize 2M
        php_value max_input_time 300
        php_value always_populate_raw_post_data -1
        php_value date.timezone Asia/shanghai
    </IfModule>
</Directory>

<Directory "/usr/share/zabbix/conf">
    Order deny,allow
    Deny from all
    <files *.php>
        Order deny,allow
                Deny from all
    </files>                                                                                                                   
</Directory>                                                                                                                   
                                                                                                                               
<Directory "/usr/share/zabbix/app">                                                                                            
    Order deny,allow                                                                                                           
    Deny from all                                                                                                              
    <files *.php>                                                                                                              
        Order deny,allow                                                                                                       
        Deny from all                                                                                                          
    </files>                                                                                                                   
</Directory>                                                                                                                   
                                                                                                                               
<Directory "/usr/share/zabbix/include">                                                                                        
    Order deny,allow                                                                                                           
    Deny from all                                                                                                              
    <files *.php>                                                                                                              
        Order deny,allow                                                                                                       
        Deny from all                                                                                                          
    </files>                                                                                                                   
</Directory>                                                                                                                   
                                                                                                                               
<Directory "/usr/share/zabbix/local">                                                                                          
    Order deny,allow                                                                                                           
    Deny from all                                                                                                              
    <files *.php>                                                                                                              
        Order deny,allow 
        Deny from all                                                                                                          
    </files>                                                                                                                   
</Directory>


我的實際操作是在conf-enabled/zabbix.conf 文件中取消了Alias … 配置,並在sites-available/000-default.conf中修改了80 端口的網頁根目錄;然後再將這個文件通過ln -s 命令連接到sites-enable 目錄下;


這樣我就可以直接通過http://x.x.x.x訪問zabbix web了;

wKioL1bW2WOgzUH9AAFr4NnHO5k795.jpg


!建議在web界面配置前修改

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章