Просмотр исходного кода

【nginx】【docker】

1.增加nginx配置
2.增加gogs配置
ChenYL 1 год назад
Родитель
Сommit
91df3e61f2

+ 50 - 0
aliyun-nginx/conf.d/git.conf

@@ -0,0 +1,50 @@
+# git service
+
+server {
+  server_name git.zhixinghe1.top;
+  
+  gzip on;
+
+  
+  location / {
+    proxy_redirect off;
+    proxy_pass http://localhost:10880;
+
+    proxy_set_header  Host                $http_host;
+    proxy_set_header  X-Real-IP           $remote_addr;
+    proxy_set_header  X-Forwarded-Ssl     on;
+    proxy_set_header  X-Forwarded-For     $proxy_add_x_forwarded_for;
+    proxy_set_header  X-Forwarded-Proto   $scheme;
+    proxy_set_header  X-Frame-Options     SAMEORIGIN;
+
+    client_max_body_size        100m;
+    client_body_buffer_size     128k;
+
+    proxy_buffer_size           4k;
+    proxy_buffers               4 32k;
+    proxy_busy_buffers_size     64k;
+    proxy_temp_file_write_size  64k;
+    
+  }
+
+    listen 443 ssl; # managed by Certbot
+    ssl_certificate /etc/letsencrypt/live/git.zhixinghe1.top/fullchain.pem; # managed by Certbot
+    ssl_certificate_key /etc/letsencrypt/live/git.zhixinghe1.top/privkey.pem; # managed by Certbot
+    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
+    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
+
+}
+
+
+server {
+    if ($host = git.zhixinghe1.top) {
+        return 301 https://$host$request_uri;
+    } # managed by Certbot
+
+
+  listen 80;
+  server_name git.zhixinghe1.top;
+    return 404; # managed by Certbot
+
+
+}

+ 39 - 0
aliyun-nginx/conf.d/punch-settle.conf

@@ -0,0 +1,39 @@
+# fanqiang service
+server {
+  server_name api-punchsettle.zhixinghe1.top;
+  
+  location / {
+    add_header Access-Control-Allow-Origin *;
+    proxy_redirect off;
+    proxy_pass http://localhost:8080;
+    proxy_http_version 1.1;
+    proxy_set_header Upgrade $http_upgrade;
+    proxy_set_header Connection "upgrade";
+    #proxy_set_header Host $http_host;
+    proxy_set_header Host $host:$server_port;
+    proxy_set_header X-Real-IP $remote_addr;
+    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+  }
+
+
+
+    listen 443 ssl; # managed by Certbot
+    ssl_certificate /etc/letsencrypt/live/api-punchsettle.zhixinghe1.top/fullchain.pem; # managed by Certbot
+    ssl_certificate_key /etc/letsencrypt/live/api-punchsettle.zhixinghe1.top/privkey.pem; # managed by Certbot
+    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
+    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
+
+}
+
+server {
+    if ($host = api-punchsettle.zhixinghe1.top) {
+        return 301 https://$host$request_uri;
+    } # managed by Certbot
+
+
+  listen 80 ;
+  server_name api-punchsettle.zhixinghe1.top;
+    return 404; # managed by Certbot
+
+
+}

+ 25 - 0
aliyun-nginx/conf.d/www.conf

@@ -0,0 +1,25 @@
+server {
+  server_name www.zhixinghe1.top;
+  
+  root /root/web/izhixing.github.io;
+  index index.html;
+
+    listen 443 ssl; # managed by Certbot
+    ssl_certificate /etc/letsencrypt/live/www.zhixinghe1.top/fullchain.pem; # managed by Certbot
+    ssl_certificate_key /etc/letsencrypt/live/www.zhixinghe1.top/privkey.pem; # managed by Certbot
+    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
+    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
+
+}
+server {
+    if ($host = www.zhixinghe1.top) {
+        return 301 https://$host$request_uri;
+    } # managed by Certbot
+
+
+  listen 80;
+  server_name www.zhixinghe1.top;
+    return 404; # managed by Certbot
+
+
+}

+ 39 - 0
aliyun-nginx/nginx.conf

@@ -0,0 +1,39 @@
+# For more information on configuration, see:
+#   * Official English Documentation: http://nginx.org/en/docs/
+#   * Official Russian Documentation: http://nginx.org/ru/docs/
+
+#user nginx;
+user root;
+worker_processes auto;
+error_log /var/log/nginx/error.log;
+pid /run/nginx.pid;
+
+# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
+include /usr/share/nginx/modules/*.conf;
+
+events {
+    worker_connections 1024;
+}
+
+http {
+    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+                      '$status $body_bytes_sent "$http_referer" '
+                      '"$http_user_agent" "$http_x_forwarded_for"';
+
+    access_log  /var/log/nginx/access.log  main;
+
+    sendfile            on;
+    tcp_nopush          on;
+    tcp_nodelay         on;
+    keepalive_timeout   65;
+    types_hash_max_size 4096;
+
+    include             /etc/nginx/mime.types;
+    default_type        application/octet-stream;
+	
+    # Load modular configuration files from the /etc/nginx/conf.d directory.
+    # See http://nginx.org/en/docs/ngx_core_module.html#include
+    # for more information.
+    include /etc/nginx/conf.d/*.conf;
+}
+

+ 14 - 0
docker-compose/gogs/docker-compose.yaml

@@ -0,0 +1,14 @@
+version: "3"
+services:
+  gogs:
+    image: gogs/gogs:latest
+    container_name: gogs
+    ports:
+      - 10880:3000
+    volumes:
+      - /root/gogs:/data
+    environment:
+      - TZ=Asia/Shanghai
+    stdin_open: true
+    tty: true
+    restart: always