提交 bc939f11 编写于 作者: 小傅哥's avatar 小傅哥

feat: ssl nginx 部署

上级
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store
/.idea/
version: '3'
# docker-compose -f docker-compose.yml up -d
services:
nginx:
image: nginx:1.25.3
container_name: nginx
ports:
- '443:443'
- '80:80'
volumes:
- './nginx/logs:/var/log/nginx'
- './nginx/html:/usr/share/nginx/html'
- './nginx/conf/nginx.conf:/etc/nginx/nginx.conf'
- './nginx/conf/conf.d:/etc/nginx/conf.d'
- '/root/.acme.sh/*.xiaofuge.tech_ecc/*.xiaofuge.tech.cer:/root/.acme.sh/*.xiaofuge.tech_ecc/*.xiaofuge.tech.cer'
- '/root/.acme.sh/*.xiaofuge.tech_ecc/*.xiaofuge.tech.key:/root/.acme.sh/*.xiaofuge.tech_ecc/*.xiaofuge.tech.key'
privileged: true
restart: always
\ No newline at end of file
server {
listen 80;
listen [::]:80;
location / {
root /usr/share/nginx/html;
index index.html;
}
location /api {
root /usr/share/nginx/html;
index index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
\ No newline at end of file
server {
listen 80;
listen [::]:80;
server_name ssl01.xiaofuge.tech;
rewrite ^(.*) https://$server_name$1 permanent;
}
server {
listen 443 ssl;
server_name ssl01.xiaofuge.tech;
ssl_certificate /root/.acme.sh/*.xiaofuge.tech_ecc/*.xiaofuge.tech.cer;
ssl_certificate_key /root/.acme.sh/*.xiaofuge.tech_ecc/*.xiaofuge.tech.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
\ No newline at end of file
server {
listen 80;
listen [::]:80;
server_name ssl02.xiaofuge.tech;
rewrite ^(.*) https://$server_name$1 permanent;
}
server {
listen 443 ssl;
server_name ssl02.xiaofuge.tech;
ssl_certificate /root/.acme.sh/*.xiaofuge.tech_ecc/*.xiaofuge.tech.cer;
ssl_certificate_key /root/.acme.sh/*.xiaofuge.tech_ecc/*.xiaofuge.tech.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
\ No newline at end of file
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;
include /etc/nginx/conf.d/*.conf;
}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Nginx - 小傅哥</title>
</head>
<body>
Hi Body Congratulations on your successful deployment!
</body>
</html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册