From dc27007bb6c9ab84881eed263efc2e900c73be89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=8B=87?= Date: Thu, 12 Aug 2021 20:17:46 +0800 Subject: [PATCH] add openresty config files --- conf.d/music-room.conf | 52 +++++++++++++++++++++++++++++ nginx.conf | 74 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 conf.d/music-room.conf create mode 100644 nginx.conf diff --git a/conf.d/music-room.conf b/conf.d/music-room.conf new file mode 100644 index 0000000..00889b8 --- /dev/null +++ b/conf.d/music-room.conf @@ -0,0 +1,52 @@ +server { + server_name music-room.alchemy-studio.cn; + listen 443 ssl; + + set $store_dir "/file_upload/"; # 文件存储路径 + + location / { + try_files $uri $uri/ /index.html; + proxy_set_header Host music-room.alchemy-studio.cn; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-Proto https; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Host $remote_addr; + + } + + root /usr/local/openresty/nginx/html/music-room; + index index.html; + +location /test_hello_world { + #设置content type + default_type text/html ; + # HTTP Status Code 和 内容 + return 200 "hello world! "; +} + + #Upload dir + location /append_file_output { + default_type ""; + alias /file_upload; + autoidex on; + autoindex_exact_size off; + autoindex_localtime on; + } + + #Upload image file + location /upload_image { + content_by_lua_file /usr/local/openresty/resty_funcs/upload_image.lua; + } + + location /ws/ { + proxy_pass http://127.0.0.1:3001/; + proxy_set_header Host music-room.alchemy-studio.cn; + } + location /uc/ { + proxy_pass http://127.0.0.1:3000/; + proxy_set_header Host music-room.alchemy-studio.cn; + } + + ssl_certificate /etc/letsencrypt/live/music-room.alchemy-studio.cn/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/music-room.alchemy-studio.cn/privkey.pem; # managed by Certbot +}n diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..dc86869 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,74 @@ + +#user nobody; +worker_processes 1; + +#error_log logs/error.log; +#error_log logs/error.log notice; +error_log logs/error.log info; + +#pid logs/nginx.pid; + + + +events { + worker_connections 1024; +} + + +http { + lua_package_path "/usr/local/openresty/resty_funcs/?.lua;;"; + include 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 logs/access.log main; + + sendfile on; + #tcp_nopush on; + + #keepalive_timeout 0; + keepalive_timeout 65; + + #gzip on; + + + server { + serer_name alchemy-studio.cn; # managed by Certbot + root /home/nginx/website; + index index.html; + + location /wy7of6ofMw.txt { + alias /home/nginx/website/wx_verify/wy7of6ofMw.txt; + } + + location / { + try_files $uri $uri/ /index.html =404; + } + + listen [::]:443 ssl ipv6only=on; # managed by Certbot + listen 443 ssl; # managed by Certbot + ssl_certificate /etc/letsencrypt/live/alchemy-studio.cn/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/alchemy-studio.cn/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 { + + listen 80 ; + listen [::]:80 ; + server_name alchemy-studio.cn; + + location / { + return 301 https://$host$request_uri; + } + } + + include /usr/local/openresty/nginx/conf.d/music-room.conf; + #include /usr/local/openresty/nginx/conf.d/resty_funcs.conf; +} +v