Parcourir la source

【nginx】

1.增加nginx配置
ChenYL il y a 1 an
Parent
commit
642fd9dad0

+ 0 - 12
docker-compose/nginx/conf.d/fs.conf

@@ -1,12 +0,0 @@
-# file service
-server {
-  listen 443 ssl;
-  server_name fs.zhixinghe1.top;
-  
-  location / {
-    root /fs;
-    autoindex on;
-    autoindex_exact_size off;
-    autoindex_localtime on;
-  }
-}

+ 0 - 17
docker-compose/nginx/conf.d/www.conf

@@ -1,17 +0,0 @@
-# default service
-server {
-  listen 443 ssl;
-  server_name www.zhixinghe1.top;
-  
-  location / {
-	root /usr/share/nginx/html;
-	index index.html index.htm;
-  }
-  
-  location /.well-known {
-	alias /web/;
-	autoindex on;
-  }
-}
-	
-

+ 0 - 19
docker-compose/nginx/docker-compose.yml

@@ -1,19 +0,0 @@
-version: "3"
-services:
-  service.nginx:
-    image: nginx:1.22.1
-    container_name: nginx
-    ports:
-      - 80:80
-      - 443:443
-    volumes:
-      - /home/zkpk/nginx/nginx.conf:/etc/nginx/nginx.conf
-      - /home/zkpk/nginx/conf.d:/etc/nginx/conf.d
-      - /etc/letsencrypt:/etc/letsencrypt
-      - /home/zkpk/nginx/fs:/fs
-      - /home/zkpk/nginx/web:/web
-    extra_hosts:
-      localhost.com: 172.17.0.1
-    stdin_open: true
-    tty: true
-    restart: always

+ 0 - 37
docker-compose/nginx/nginx.conf

@@ -1,37 +0,0 @@
-user  nginx;
-worker_processes  auto;
-
-error_log  /var/log/nginx/error.log notice;
-pid        /var/run/nginx.pid;
-
-events {
-    worker_connections  1024;
-}
-
-http {
-    include       /etc/nginx/mime.types;
-    default_type  application/octet-stream;
-
-    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;
-
-    keepalive_timeout  65;
-
-    #gzip  on;
-	
-	#全局SSL配置
-	ssl_session_timeout 5m;
-	ssl_prefer_server_ciphers on;
-	ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
-	ssl_certificate /etc/letsencrypt/live/zhixinghe1.top/fullchain.pem;
-	ssl_certificate_key /etc/letsencrypt/live/zhixinghe1.top/privkey.pem;
-	ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
-
-    include /etc/nginx/conf.d/*.conf;
-}

+ 6 - 2
docker-compose/nginx/conf.d/fq.conf → virmach-nginx/conf.d/fq.conf

@@ -1,12 +1,13 @@
 # fanqiang service
 server {
+
   listen 443 ssl;
-  server_name fq.zhixinghe1.top;
+  server_name fq.20261001.xyz;
   
   location / {
     add_header Access-Control-Allow-Origin *;
     proxy_redirect off;
-    proxy_pass http://localhost.com:19090;
+    proxy_pass http://localhost:19090;
     proxy_http_version 1.1;
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection "upgrade";
@@ -15,4 +16,7 @@ server {
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   }
+
+    ssl_certificate /etc/letsencrypt/live/fq.20261001.xyz-0001/fullchain.pem; # managed by Certbot
+    ssl_certificate_key /etc/letsencrypt/live/fq.20261001.xyz-0001/privkey.pem; # managed by Certbot
 }

+ 16 - 0
virmach-nginx/conf.d/fs.conf

@@ -0,0 +1,16 @@
+# file service
+server {
+
+  listen 443 ssl;
+  server_name fs.20261001.xyz;
+  
+  location / {
+    root /home/zkpk/nginx/fs;
+    autoindex on;
+    autoindex_exact_size off;
+    autoindex_localtime on;
+  }
+
+    ssl_certificate /etc/letsencrypt/live/fs.20261001.xyz/fullchain.pem; # managed by Certbot
+    ssl_certificate_key /etc/letsencrypt/live/fs.20261001.xyz/privkey.pem; # managed by Certbot
+}

+ 7 - 2
docker-compose/nginx/conf.d/git.conf → virmach-nginx/conf.d/git.conf

@@ -2,13 +2,14 @@
 
 server {
   listen 443 ssl;
-  server_name git.zhixinghe1.top;
+  server_name git.20261001.xyz;
   
   gzip on;
+
   
   location / {
     proxy_redirect off;
-    proxy_pass http://localhost.com:10880;
+    proxy_pass http://localhost:10880;
 
     proxy_set_header  Host                $http_host;
     proxy_set_header  X-Real-IP           $remote_addr;
@@ -26,4 +27,8 @@ server {
     proxy_temp_file_write_size  64k;
     
   }
+
+
+    ssl_certificate /etc/letsencrypt/live/git.20261001.xyz/fullchain.pem; # managed by Certbot
+    ssl_certificate_key /etc/letsencrypt/live/git.20261001.xyz/privkey.pem; # managed by Certbot
 }

+ 22 - 0
virmach-nginx/conf.d/punch-settle.conf

@@ -0,0 +1,22 @@
+# fanqiang service
+server {
+  listen 443 ssl;
+  server_name api-punchsettle.20261001.xyz;
+  
+  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;
+  }
+
+
+    ssl_certificate /etc/letsencrypt/live/api-punchsettle.20261001.xyz/fullchain.pem; # managed by Certbot
+    ssl_certificate_key /etc/letsencrypt/live/api-punchsettle.20261001.xyz/privkey.pem; # managed by Certbot
+}

+ 0 - 0
docker-compose/nginx/conf.d/rewrite443.conf → virmach-nginx/conf.d/rewrite443.conf


+ 95 - 0
virmach-nginx/nginx.conf

@@ -0,0 +1,95 @@
+# /etc/nginx/nginx.conf
+
+user nginx;
+
+# Set number of worker processes automatically based on number of CPU cores.
+worker_processes auto;
+
+# Enables the use of JIT for regular expressions to speed-up their processing.
+pcre_jit on;
+
+# Configures default error logger.
+error_log /var/log/nginx/error.log warn;
+
+# Includes files with directives to load dynamic modules.
+include /etc/nginx/modules/*.conf;
+
+
+events {
+	# The maximum number of simultaneous connections that can be opened by
+	# a worker process.
+	worker_connections 1024;
+}
+
+http {
+	# Includes mapping of file name extensions to MIME types of responses
+	# and defines the default type.
+	include /etc/nginx/mime.types;
+	default_type application/octet-stream;
+
+	# Name servers used to resolve names of upstream servers into addresses.
+	# It's also needed when using tcpsocket and udpsocket in Lua modules.
+	#resolver 208.67.222.222 208.67.220.220;
+
+	# Don't tell nginx version to clients.
+	server_tokens off;
+
+	# Specifies the maximum accepted body size of a client request, as
+	# indicated by the request header Content-Length. If the stated content
+	# length is greater than this size, then the client receives the HTTP
+	# error code 413. Set to 0 to disable.
+	client_max_body_size 1m;
+
+	# Timeout for keep-alive connections. Server will close connections after
+	# this time.
+	keepalive_timeout 65;
+
+	# Sendfile copies data between one FD and other from within the kernel,
+	# which is more efficient than read() + write().
+	sendfile on;
+
+	# Don't buffer data-sends (disable Nagle algorithm).
+	# Good for sending frequent small bursts of data in real time.
+	tcp_nodelay on;
+
+	# Causes nginx to attempt to send its HTTP response head in one packet,
+	# instead of using partial frames.
+	#tcp_nopush on;
+
+
+	# Path of the file with Diffie-Hellman parameters for EDH ciphers.
+	#ssl_dhparam /etc/ssl/nginx/dh2048.pem;
+
+	# Specifies that our cipher suits should be preferred over client ciphers.
+	#ssl_prefer_server_ciphers on;
+
+	# Enables a shared SSL cache with size that can hold around 8000 sessions.
+	ssl_session_cache shared:SSL:2m;
+	
+	# 全局SSL配置
+        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
+        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
+
+
+	# Enable gzipping of responses.
+	#gzip on;
+
+	# Set the Vary HTTP header as defined in the RFC 2616.
+	gzip_vary on;
+
+	# Enable checking the existence of precompressed files.
+	#gzip_static on;
+
+
+	# Specifies the main log format.
+	log_format main '$remote_addr - $remote_user [$time_local] "$request" '
+			'$status $body_bytes_sent "$http_referer" '
+			'"$http_user_agent" "$http_x_forwarded_for"';
+
+	# Sets the path, format, and configuration for a buffered log write.
+	access_log /var/log/nginx/access.log main;
+
+
+	# Includes virtual hosts configs.
+	include /etc/nginx/conf.d/*.conf;
+}