安裝環境:javascript
[root@nginx showdoc]# cat /etc/centos-release #系統版本 CentOS Linux release 7.5.1804 (Core) [root@nginx showdoc]# /usr/local/nginx/sbin/nginx -v #nginx版本 nginx version: nginx/1.10.2 php 5.5.30 #php版本
當前包: grafana-5.3.4-1.x86_64.rpm
網卡配置php
[root@nginx nginx]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=9d933367-ed49-4b19-a2a5-e8dabdf4ac26
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.1.12
PREFIX=24
IPADDR1=192.168.1.13
PREFIX1=24
GATEWAY=192.168.1.1
IPV6_PRIVACY=no
ZONE=publiccss
須要安裝php依賴:html
sudo apt-get install -y php7.1 php7.1-fpm php7.1-gd php7.1-mcrypt php7.1-mbstring php7.1-mysql php7.1-pdo php7.1-sqlite
下載代碼java
git clone https://github.com/star7th/showdoc.git #showdoc下載
當前包: grafana-5.3.4-1.x86_64.rpm
sudo yum localinstall grafana-5.2.4-1.x86_64.rpm #安裝
systemctl daemon-reload
systemctl enable grafana-server.service #設置開機啓動
systemctl start grafana-server.service
systemctl status grafana-server.service #啓動grafananode
帳號密碼均爲:admin #grafanapython
ps -ef | grep grafanamysql
netstat -lntp | grep grafana #端口號3000nginx
把克隆下來的文件夾移動到nginx的訪問目錄下:git
mv showdoc /usr/local/nginx/html/
而後賦予權限:
chmod -R 777 showdoc
修改nginx配置文件:
vim /usr/local/nginx/nginx.conf #編譯時選擇的安裝目錄
nginx關聯php來啓動
從新驗證配置和重啓nginx:
/usr/local/nginx/sbin/nginx -t /usr/local/nginx/sbin/nginx -s reload
訪問本地ip安裝便可:
http://192.168.1.12/install
nginx全部配置
html主頁面設置
[root@nginx html]# cat index.html
<html> <head><meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <link rel="stylesheet" href="css/varbar.css"/> <!-- 調用css --> <!--<link rel="stylesheet" href="css/style.default.css" id="theme-stylesheet">--> <title>運維</title> <base target="iframe"/> </head> <body> <div class="menu"> <!-- class選擇器 --> <div class="nav"> <ul><li><a href="http://192.168.1.12/welcome.html"><h5 align="center">首頁<h5></a><li></ul> <ul><li><a href="http://192.168.1.12:81"><h5 align="center">信息管理業<h5></a></li></ul> <ul><li><a href="http://192.168.1.12:84"><h5 align="center">zabbix<h5></a></li></ul> <ul><li><a href="http://192.168.1.12:82"><h5 align="center">資源共享<h5></a></li></ul>
<ul><li><a href="http://192.168.1.12:3000"><h5 align="center">Grafana<h5></a></li></ul> </div> </nav> <div id="content"> <!-- 右側 --> <iframe frameboder="0" border="0" scrolling="yes" name="iframe" src="welcome.html" style="width:98%;height:98%"></iframe> </div> </div> </body> </html>
css樣式配置
[root@nginx html]# cat css/varbar.css
body
{
text-align:center; /* 文字居中 */
}
ul
{
list-style-type:none; /* ul前面的點 */
}
* {
margin:0px 0px; /* 到邊框的距離 */
}
.menu
{
background:#F8F8FF; /* 導航條背景的顏色 */
}
.nav
{
margin:0 auto; /* 導航欄文字的位置 */
width:700px; /* 和文字寬度有關,不能小於文字寬度的總和 */
height:50px; /* 導航欄的寬度 */
}
.nav a
{
float:left; /* 導航欄的位置配置 */
width:120px; /* 選中的文字塊的長度 */
line-height:50px; /* 選中的文字塊的寬度 */
text-decoration: none; /* 去掉鏈接下劃線 */
font-size:25px; /* 字體大小 */
color: #FF1493; /* 字體顏色 */
}
.nav li a:hover
{
background-color: #D8D8D8; /* 選中的文字塊的顏色 */
text-decoration:none; /* 選中時去掉鏈接下劃線 */
}
.nav li a:link{
text-decoration:none; /* 鏈接被點以後沒有下劃線 */
導航首頁(歡迎頁)配置
[root@nginx html]# cat welcome.html <html> <head> <title>運維</title> <meta charset="UTF-8"> <div style="text-align:center;"> <style type="text/css"> a:link,a:visited{ text-decoration:none; /*超連接無下劃線*/ } a:hover{ text-decoration:underline; /*鼠標放上去有下劃線*/ } </style> <h1>嘉配運維</h1> </div> </head> </html>
cat /usr/local/nginx/nginx.conf
user root; #worker_processes 1; error_log /usr/local/nginx/logs/error.log; pid /usr/local/nginx/nginx.pid; ## Events Module ## worker_processes 8; worker_rlimit_nofile 65536; events { use epoll; worker_connections 10240; } ## End of Events Module ## ## Http ## http { include mime.types; default_type application/octet-stream; charset utf-8; # log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; # log_format main '$remote_addr "$time_iso8601" "$request" ' '$status $body_bytes_sent "$http_user_agent" "$http_referer" "$http_x_forwarded_for" ' '"$request_time" "$upstream_response_time" "$http_cookie" "$http_Authorization" "$http_token"'; access_log /usr/local/nginx/logs/access.log; server_tokens off; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; keepalive_requests 150; # server_names_hash_bucket_size 128; # client_header_buffer_size 32k; # large_client_header_buffers 4 32k; # client_max_body_size 8m; fastcgi_connect_timeout 180; fastcgi_send_timeout 180; fastcgi_read_timeout 180; fastcgi_buffer_size 64k; fastcgi_buffers 4 64k; fastcgi_busy_buffers_size 128k; fastcgi_temp_file_write_size 128k; gzip on; gzip_min_length 1k; gzip_buffers 4 256k; gzip_http_version 1.1; gzip_comp_level 9; gzip_types text/plain application/x-javascript text/css application/xml; ## Virtual Hosts Include ## include /usr/local/nginx/conf.d/*.conf; ## End of Virtual Hosts Include ## } ## End of Http ##
cd /usr/local/nginx/conf.d
nginx網站根目錄配置
[root@nginx conf.d]# cat root.conf ## VirtualHost for showdoc ## server { listen 80; server_name localhost; location / { root /usr/local/nginx/html; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root /usr/local/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
nginx 文件服務配置
[root@nginx conf.d]# cat docfile.conf server { listen 82; charset utf-8; server_name localhost; root /usr/local/nginx/html/docfile; location / { autoindex on; #開啓索引功能 autoindex_exact_size off; # 關閉計算文件確切大小(單位bytes),只顯示大概大小(單位kb、mb、gb) autoindex_localtime on; # 顯示本機時間而非 GMT 時間 } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }
zabbix配置
server { listen 84; charset utf-8; server_name 192.168.1.12; location / { root /usr/local/nginx/html/zabbix; index index.html index.htm index.php; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root /usr/local/nginx/html/zabbix; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
grafana配置
vim /usr/local/nginx/conf.d/grafana.conf
## VirtualHost for grafana ##
server {
listen 3001;
charset utf-8;
server_name 192.168.1.12;
location / {
root /usr/share/grafana/public/views/;
index index.html index.htm index.php;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /usr/share/grafana/public/views/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
showdoc文檔配置
[root@nginx conf.d]# cat showdoc.conf ## VirtualHost for showdoc ## server { listen 81; server_name localhost; location / { root /usr/local/nginx/html/showdoc; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root /usr/local/nginx/html/showdoc; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
/usr/lcoal/nginx/sbin/nginx -t #重寫配置
/usr/lcoal/nginx/sbin/nginx -s reload #重啓nginx
ps -ef | grep nginx #查看nginx進程