添加acme,frps和nginx项目

This commit is contained in:
Dennis Mo
2020-05-19 22:44:58 +08:00
parent 71a107eeed
commit 4ddd5f14a2
15 changed files with 411 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
server {
listen 80;
server_name git.woyue.org;
server_tokens off;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name git.woyue.org;
server_tokens off;
ssl_certificate /etc/letsencrypt/live/git.woyue.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/git.woyue.org/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_pass http://172.20.0.3:3000;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
}
}

View File

@@ -0,0 +1,40 @@
user root;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
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;
autoindex on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
#gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary off;
gzip_disable "MSIE [1-6]\.";
client_max_body_size 100M;
client_header_buffer_size 128k;
large_client_header_buffers 4 128k;
include /etc/nginx/conf.d/*.conf;
}

31
nginx/docker-compose.yml Normal file
View File

@@ -0,0 +1,31 @@
version: "3.5"
#设定network. 其他应用应设置network的external为本网络以和nginx服务器互通。
networks:
firstnet:
name:nginx_firstnet
ipam:
config:
- subnet: 172.20.0.0/16
services:
nginx:
image: nginx:latest
restart: unless-stopped
volumes:
- ./data/conf/conf.d:/etc/nginx/conf.d
- ./data/conf/nginx.conf:/etc/nginx/nginx.conf
- ./data/html:/usr/share/nginx/html
- ./data/logs:/var/log/nginx
# 此处的配置取决于conf.d下的配置文件中如何配置证书路径。例如“ssl_certificate /etc/letsencrypt/live/git.woyue.org/fullchain.pem;”等
- ../certbot/conf:/etc/letsencrypt
# 此处的配置取决于conf.d下的配置文件中的配置“location /.well-known/acme-challenge/”可参看sample.conf
- ../certbot/www:/var/www/certbot
networks:
firstnet:
ipv4_address: 172.20.0.2
ports:
- "80:80"
- "443:443"
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"

19
nginx/nginx.projitems Normal file
View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>36f1d233-df91-469d-b27b-157982e326f0</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>nginx</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)docker-compose.yml" />
<None Include="$(MSBuildThisFileDirectory)data\conf\conf.d\sample.conf.bk" />
<None Include="$(MSBuildThisFileDirectory)data\conf\nginx.conf" />
</ItemGroup>
<ItemGroup>
<Folder Include="$(MSBuildThisFileDirectory)data\" />
</ItemGroup>
</Project>

13
nginx/nginx.shproj Normal file
View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>36f1d233-df91-469d-b27b-157982e326f0</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="nginx.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>