Skip to content

Commit

Permalink
update post 9002
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhongFuze committed Aug 29, 2024
1 parent 550c52b commit 462ed04
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ COPY src .
COPY run.sh .
COPY supervisord.conf .

EXPOSE 9001
EXPOSE 9002
ENTRYPOINT ["./run.sh"]
14 changes: 7 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
- ~/app/nginx/logs:/var/log/nginx
- ~/app/nginx/ssl:/etc/ssl
ports:
- "9002:9001"
- "9001:9002"
depends_on:
- id_allocation
networks:
Expand All @@ -20,12 +20,12 @@ services:
image: ghcr.io/zhongfuze/id_allocation:main
container_name: id_allocation
volumes:
- ~/app/data:/app/data
- ~/app/config:/app/config
- ~/app/log_tmp:/tmp
- ~/app/log:/app/log
- ~/app/id_allocation/data:/app/data
- ~/app/id_allocation/config:/app/config
- ~/app/id_allocation/log_tmp:/tmp
- ~/app/id_allocation/log:/app/log
ports:
- "9001:9001"
- "9002:9002"
networks:
put_net:
ipv4_address: 192.168.100.3
Expand All @@ -35,4 +35,4 @@ networks:
driver: bridge
ipam:
config:
- subnet: 192.168.100.0/24
- subnet: 192.168.100.0/24
4 changes: 2 additions & 2 deletions src/config/main.sample.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[server]
server_name = "id_allocation"
ip = "127.0.0.1"
port = 9001
ip = "0.0.0.0"
port = 9002
work_path = "/app"
thread_count = 8
process_count = 6
Expand Down
14 changes: 3 additions & 11 deletions src/config/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,10 @@ http {

server {
listen 9001;
server_name ec2-18-167-19-252.ap-east-1.compute.amazonaws.com;
server_name localhost;

# Deny access to all resources by default
location / {
deny all;
return 403;
}

# Allow access to the specific endpoint
location /id_allocation/allocation {
allow all;
proxy_pass http://192.168.100.3:9001;
location /id_allocation/ {
proxy_pass http://id_allocation:9002/id_allocation/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down
47 changes: 47 additions & 0 deletions src/config/nginx/nginx.conf.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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;

keepalive_timeout 65;

include /etc/nginx/conf.d/*.conf;

server {
listen 9001;
server_name ec2-18-167-19-252.ap-east-1.compute.amazonaws.com;

# Deny access to all resources by default
location / {
deny all;
return 403;
}

# Allow access to the specific endpoint
location /id_allocation/allocation {
allow all;
proxy_pass http://192.168.100.3:9001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
}

0 comments on commit 462ed04

Please sign in to comment.