Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

employee-system-dev001-cluster-nginx - Cluster deployment, distrubition lock, with Nignx #137

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions springEmployeeSystem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,26 @@ cd springEmployeeSystem/frontend/employee-system-ui
npm run serve
```


```bash
#---------------------------
# Run Nginx
#---------------------------

# start nginx service
brew services start nginx

# stop
brew services stop nginx

# macbook M1
# /opt/homebrew/etc/nginx
# /opt/homebrew/etc/nginx/nginx.conf

# reload config
nginx -s reload
```

</details>

## API
Expand Down
99 changes: 99 additions & 0 deletions springEmployeeSystem/backend/EmployeeSystem/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@

# https://youtu.be/CDaWk2RIBL4?si=dfe4B7Ct4fsPSOGW&t=315
# https://github.com/yennanliu/utility_shell/blob/master/nginx/nginx_backup.conf

#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 {
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;

# load balance, reverse proxy
# https://youtu.be/CDaWk2RIBL4?si=k5piBHOSF-7vNTh1&t=392
upstream distributedLock {
server localhost:9998;
server localhost:9999;
}

server {
listen 8080;
server_name localhost;

# update Nginx resend waiting time, to avoid Nginx send redundant requests due to server slow response
# https://youtu.be/_7VL1DUlq1Q?si=5WvAFE8xxvnyfilM&t=779
proxy_connect_timeout 12000; # 12 sec
proxy_send_timeout 12000;
proxy_read_timeout 12000;

location / {
# root html;
# index index.html index.htm;
proxy_pass http://distributedLock;
}

}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}


# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}
include servers/*;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
logging.level.org.hibernate.SQL=debug
spring.jpa.properties.hibernate.globally_quoted_identifiers=true

server.port=9998
server.port=9999

# open all actuator endpoints(shutdown is not included) (DO MODIFY BELOW when DEPLOY TO PROD ENV)
management.endpoints.web.exposure.include=*
Expand Down