From 3f6313759e6b5fb2fc46b734d64ae67219ed52a8 Mon Sep 17 00:00:00 2001 From: shylinux Date: Thu, 8 Sep 2022 13:35:30 +0800 Subject: [PATCH] opt some --- etc/conf/header.conf | 1 - etc/conf/location.conf | 7 +++---- etc/conf/nginx.conf | 43 +++++++++++++++++------------------------- etc/init.shy | 3 +++ etc/path | 4 ---- src/main.go | 2 ++ src/main.shy | 2 +- 7 files changed, 26 insertions(+), 36 deletions(-) diff --git a/etc/conf/header.conf b/etc/conf/header.conf index df70fbc3..81bb4ab0 100644 --- a/etc/conf/header.conf +++ b/etc/conf/header.conf @@ -1,4 +1,3 @@ proxy_set_header X-HOST $scheme://$http_host/; proxy_set_header X-Real-Port $remote_port; proxy_set_header X-Real-IP $remote_addr; - diff --git a/etc/conf/location.conf b/etc/conf/location.conf index 80459f82..b7917c33 100644 --- a/etc/conf/location.conf +++ b/etc/conf/location.conf @@ -13,18 +13,17 @@ client_body_temp_path /tmp/nginx/client_body_temp; location / { include header.conf; - proxy_pass http://127.0.0.1:9020; + proxy_pass http://contexts; } location /space/ { include header.conf; - proxy_pass http://127.0.0.1:9020; + proxy_pass http://contexts; proxy_set_header Connection "upgrade"; proxy_set_header Upgrade $http_upgrade; } location /x/ { include header.conf; - proxy_pass http://127.0.0.1:9030; + proxy_pass http://contexts_repos; } - diff --git a/etc/conf/nginx.conf b/etc/conf/nginx.conf index 5607e49b..bc5cd6ce 100644 --- a/etc/conf/nginx.conf +++ b/etc/conf/nginx.conf @@ -9,52 +9,43 @@ http { proxy_buffering off; keepalive_timeout 1800; - server { - listen 80; - server_name shylinux.com; + log_format access '[$time_local] $remote_addr' + ' "$request" "$http_referer" "$http_user_agent"' + ' $server_name $status $body_bytes_sent'; + access_log logs/access.log access; - location / { - include header.conf; - if ($http_user_agent ~* "^Wget") { - proxy_pass http://127.0.0.1:9020; - break; - } - return 302 https://shylinux.com/; - } + upstream contexts { + server 127.0.0.1:9020; + } + upstream contexts_repos { + server 127.0.0.1:9030; } + server { + listen 80; + server_name shylinux.com; + include locations.conf; + } server { listen 443 ssl; server_name shylinux.com; + include location.conf; ssl_certificate_key 8293704_shylinux.com.key; ssl_certificate 8293704_shylinux.com.pem; - - include location.conf; } server { listen 80; server_name contexts.com.cn; - - location / { - include header.conf; - if ($http_user_agent ~* "^Wget") { - proxy_pass http://127.0.0.1:9020; - break; - } - return 302 https://contexts.com.cn/; - } + include locations.conf; } - server { listen 443 ssl; server_name contexts.com.cn; + include location.conf; ssl_certificate_key 7424713_contexts.com.cn.key; ssl_certificate 7424713_contexts.com.cn.pem; - - include location.conf; } } - diff --git a/etc/init.shy b/etc/init.shy index 69a0040a..3ed6c91b 100644 --- a/etc/init.shy +++ b/etc/init.shy @@ -1,3 +1,6 @@ +~web.code.nginx + server module name demo + ~cli daemon import diff --git a/etc/path b/etc/path index 519893b5..7893bf56 100644 --- a/etc/path +++ b/etc/path @@ -1,7 +1,3 @@ -usr/install/busybox-1.33.0/_install/usr/sbin -usr/install/busybox-1.33.0/_install/usr/bin -usr/install/busybox-1.33.0/_install/sbin -usr/install/busybox-1.33.0/_install/bin usr/install/ffmpeg-4.2.1/_install/bin usr/install/qemu-3.1.0/_install/bin usr/install/gcc-4.8.4/_install/bin diff --git a/src/main.go b/src/main.go index a3f3ac80..80914ab0 100644 --- a/src/main.go +++ b/src/main.go @@ -23,6 +23,7 @@ import ( _ "shylinux.com/x/golang-story/src/tcmalloc" _ "shylinux.com/x/golang-story/src/docker" + _ "shylinux.com/x/golang-story/src/gotags" _ "shylinux.com/x/golang-story/src/grafana" _ "shylinux.com/x/golang-story/src/kubernetes" _ "shylinux.com/x/golang-story/src/prometheus" @@ -35,6 +36,7 @@ import ( _ "shylinux.com/x/linux-story/src/glibc" _ "shylinux.com/x/linux-story/src/kernel" _ "shylinux.com/x/linux-story/src/qemu" + _ "shylinux.com/x/linux-story/src/sysctl" _ "shylinux.com/x/mysql-story/src/client" _ "shylinux.com/x/mysql-story/src/server" diff --git a/src/main.shy b/src/main.shy index 6cf49016..25b3564d 100644 --- a/src/main.shy +++ b/src/main.shy @@ -10,7 +10,7 @@ label ` code wiki chat team mall linux nginx context redis mysql bash git golang vim tmux -` +` fg blue bg yellow chapter "理论" label `